summaryrefslogtreecommitdiffstats
path: root/third_party/jstemplate/tutorial_examples/04-jscontent.html
blob: b264f3f2e57f218562a132103449ff13f2025310 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
<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 = "Joe User";
    
    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">
Welcome <span jscontent="$this">
(This placeholder name will be replaced by the actual username.)
</span>
</div>

</body>
</html>