summaryrefslogtreecommitdiffstats
path: root/third_party/jstemplate/tutorial_examples/05-jsselect.html
diff options
context:
space:
mode:
Diffstat (limited to 'third_party/jstemplate/tutorial_examples/05-jsselect.html')
-rw-r--r--third_party/jstemplate/tutorial_examples/05-jsselect.html42
1 files changed, 42 insertions, 0 deletions
diff --git a/third_party/jstemplate/tutorial_examples/05-jsselect.html b/third_party/jstemplate/tutorial_examples/05-jsselect.html
new file mode 100644
index 0000000..990df0f
--- /dev/null
+++ b/third_party/jstemplate/tutorial_examples/05-jsselect.html
@@ -0,0 +1,42 @@
+<html>
+<head><title>Jstemplates: Quick example</title>
+ <script src="../util.js" type="text/javascript"></script>
+ <script src="../jsevalcontext.js" type="text/javascript"></script>
+ <script src="../jstemplate.js" type="text/javascript"></script>
+ <script type="text/javascript">
+
+ var tplData = {username:"Jane User",
+ addresses:[
+ {location:"111 8th Av.", label:"NYC front door"},
+ {location:"76 9th Av.", label:"NYC back door"},
+ {location:"Mountain View", label:"Mothership"}
+ ]
+ };
+
+ function showData() {
+ // This is the javascript code that processes the template:
+ var input = new JsEvalContext(tplData);
+ var output = document.getElementById('tpl');
+ jstProcess(input, output);
+ }
+ </script>
+</head>
+<body onload="showData()">
+
+<!--
+This is the template:
+-->
+
+<div id="tpl">
+<h1>
+ <span jsselect="username" jscontent="$this">User de Fault</span>'s
+ Address Book
+</h1>
+<table cellpadding="5">
+<tr><td><h2>Location:</h2></td><td><h2>Label:</h2></td></tr>
+<tr jsselect="addresses"><td jscontent="location"></td><td jscontent="label"></td></tr>
+</table>
+</div>
+
+</body>
+</html>