diff options
Diffstat (limited to 'third_party/jstemplate/tutorial_examples/07-jsdisplay-empty.html')
-rw-r--r-- | third_party/jstemplate/tutorial_examples/07-jsdisplay-empty.html | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/third_party/jstemplate/tutorial_examples/07-jsdisplay-empty.html b/third_party/jstemplate/tutorial_examples/07-jsdisplay-empty.html new file mode 100644 index 0000000..d5da9b3 --- /dev/null +++ b/third_party/jstemplate/tutorial_examples/07-jsdisplay-empty.html @@ -0,0 +1,36 @@ +<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:"Joe User", + addresses:[]}; + + 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> +<span jsdisplay="addresses.length==0">Address book is empty.</span> +<table cellpadding="5" jsdisplay="addresses.length"> +<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> |