each.html 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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="template">
  10. <ul each="{books}">
  11. <li>
  12. <label>title: </label><strong fill="{title}"></strong><br>
  13. <label>author: </label><span fill="{author}"></span>
  14. </li>
  15. </ul>
  16. </div>
  17. <script type="text/javascript">
  18. var books = {
  19. books: [
  20. {
  21. title: 'Earthquake',
  22. author: 'Ian Rohr'
  23. },
  24. {
  25. title: 'Woody Allen',
  26. author: 'Eric Lax'
  27. },
  28. {
  29. title: 'Rick Santorum',
  30. author: 'Rick Santorum'
  31. },
  32. {
  33. title: 'Memorial Day',
  34. author: 'Vince Flynn'
  35. },
  36. {
  37. title: 'Earthquake',
  38. author: 'Greg Roza'
  39. }
  40. ]
  41. };
  42. var tpl = new jsMotif.Template({
  43. template: 'template',
  44. targetNode: 'template'
  45. });
  46. tpl.render(books);
  47. </script>
  48. </body>
  49. </html>