| OLD | NEW |
| (Empty) | |
| 1 <html> |
| 2 <head><title>Jstemplates: Quick example</title> |
| 3 <script src="../util.js" type="text/javascript"></script> |
| 4 <script src="../jsevalcontext.js" type="text/javascript"></script> |
| 5 <script src="../jstemplate.js" type="text/javascript"></script> |
| 6 <script type="text/javascript"> |
| 7 var favdata = { |
| 8 title: 'Favorite Things', |
| 9 favs: ['raindrops', 'whiskers', 'mittens'] |
| 10 }; |
| 11 |
| 12 function showData(data) { |
| 13 // This is the javascript code that processes the template: |
| 14 var input = new JsEvalContext(data); |
| 15 var output = document.getElementById('t1'); |
| 16 jstProcess(input, output); |
| 17 } |
| 18 </script> |
| 19 </head> |
| 20 <body onload="showData(favdata)"> |
| 21 |
| 22 <!-- |
| 23 This is the template: |
| 24 --> |
| 25 <div id="t1"> |
| 26 <h1 jscontent="title"></h1> |
| 27 <ul><li jscontent="$this" jsselect="favs"></li></ul> |
| 28 </div> |
| 29 <p> |
| 30 <a href="#" onclick="favdata.favs.push('packages');showData(favdata);">Reprocess
</a> |
| 31 </p> |
| 32 </body> |
| 33 </html> |
| OLD | NEW |