index.html 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
  2. <html>
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  5. <script type="text/javascript" src="../build/jsMotif.js"></script>
  6. <title>jsMotif example</title>
  7. </head>
  8. <body>
  9. <div id="mainContainer">
  10. <p fill="{foo}"></p>
  11. <ul fill="{each:bar}">
  12. <li fill="{name}"></li>
  13. </ul>
  14. <p fill="{bar[type=='abc'][0].name}"></p>
  15. </div>
  16. <script type="text/javascript">
  17. var obj = {
  18. foo: 123,
  19. bar: [
  20. { type: 'abc', name: 'my name is abc' },
  21. { type: 'def', name: 'my name is def' },
  22. { type: 'ghi', name: 'my name is ghi' }
  23. ]
  24. }
  25. new jsMotif.Template({
  26. template: 'mainContainer',
  27. debug: jsMotif.errors.LVL.log
  28. }).render(obj);
  29. </script>
  30. </body>
  31. </html>