JTemplates使用方法源码

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>jtemplates jquery模板引擎使用-LIEHUO.NET</title>
<script src="/Scripts/jquery-1.3.2.js" type="text/javascript"></script>
<script src="/Scripts/plugins/jquery-jtemplates.js" type="text/javascript"></script>

<script type="text/javascript">
$(document).ready(function() {
var data = [{ name1: "测试信息",id:"12" },{ name1: "测试信息",id:"12" }];
$("#result").setTemplateElement("template1");
$("#result").processTemplate(data);
});
</script>
</head>
<body>
<div>
<textarea id="template1" >
<table>
<thead>
<tr>
<td colspan="2">
fdaasfd
</td>
</tr>
</thead>
<tbody>
{#foreach $T as r}
<tr>
<td>
name:{$T.r.name1}
</td>
<td>
id:{$T.r.id}
</td>
</tr>
{#/for}
</tbody>
<tfoot>
</tfoot>
</table>
</textarea>
</div>

<div id="result"></div>
</body>
</html>

原文地址:https://www.cnblogs.com/guozhe/p/2352721.html