blob: df8c7e5a5b24dcb47cc51fee1212d98e1baa9ac4 [file] [log] [blame]
<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 favdata = {
title: 'Favorite Things',
favs: ['raindrops', 'whiskers', 'mittens']
};
function showData(data) {
// This is the javascript code that processes the template:
var input = new JsEvalContext(data);
var output = document.getElementById('t1');
jstProcess(input, output);
}
</script>
</head>
<body onload="showData(favdata)">
<!--
This is the template:
-->
<div id="t1">
<h1 jscontent="title"></h1>
<ul><li jscontent="$this" jsselect="favs"></li></ul>
</div>
<p>
<a href="#" onclick="favdata.favs.push('packages');showData(favdata);">Reprocess</a>
</p>
</body>
</html>