日期:2014-05-16 浏览次数:20332 次
<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> <link href="css/index.css" rel="stylesheet" type="text/css" /> <title>DBO Example</title> </head> <body> <div align="center"> <h1>DBO Example</h1> <table id="content"></table> </div> <script id="data"></script> <script id="content-tmpl" type="tmpl"> <tr align="left"> <th class="w100">User</th> <th class="w150">Description</th> <th class="w100" colspan="2">Operation</th> </tr> <tr align="left"> <td> <input class="w90"/> </td> <td> <input class="w140" /> </td> <td> <a href="##">Save</a> </td> <td> <a href="##">Delete</a> </td> </tr> </script> <script id="user-tmpl" type="tmpl"> <tr index="${index}" align="left"> <td> ${name} </td> <td> <input class="w140" value="${desc}" /> </td> <td> <a href="##">Save</a> </td> <td> <a href="##">Delete</a> </td> </tr> </script> <script id="data-tmpl" type="tmpl"> users = ${users}; </script> <script src="js/lib/jquery.js"> </script> <script src="js/lib/jquery.tmpl.js"> </script> <script src="js/lib/json.js"> </script> <script src="js/lib/pure.js"> </script> <script src="js/both/views.js"> </script> <script src="js/index.js"> </script> </body> </html>
views = { index: function($, users) { $(users).each(function(i) { this.index = i; }); var content = $("#content-tmpl").tmpl(), rows = $("#user-tmpl").tmpl(users); $("#content").html(content); $("#content tr:first").after(rows); } };
page = function(){ pure.render.prefix = "webapp/"; retu