jQuery插件---jTemplates 模板
时间:2009-04-24
来源:互联网
<script type="text/javascript">
$(document).ready(function() {
//初始化数据
var data = {
name: '用户列表',
list_id: '编号89757',
table: [
{id: 1, name: 'Rain', age: 22, mail: '[email protected]'},
{id: 2, name: '皮特', age: 24, mail: '[email protected]'},
{id: 3, name: '卡卡', age: 20, mail: '[email protected]'},
{id: 4, name: '戏戏', age: 26, mail: '[email protected]'},
{id: 5, name: '一揪', age: 25, mail: '[email protected]'}
]
};
// 附上模板
$("#result1").setTemplateElement("template");
// 给模板加载数据
$("#result1").processTemplate(data);
});
</script>
<!-- 模板内容 -->
<textarea id="template" style="display:none">
<strong>{$T.name} : {$T.list_id}</strong>
<table>
<tr>
<th>编号</th>
<th>姓名</th>
<th>年龄</th>
<th>邮箱</th>
</tr>
{#foreach $T.table as record}
<tr>
<td>{$T.record.id}</td>
<td>{$T.record.name}</td>
<td>{$T.record.age}</td>
<td>{$T.record.mail}</td>
</tr>
{#/for}
</table>
</textarea>
=================
$T表示什么呀??
$(document).ready(function() {
//初始化数据
var data = {
name: '用户列表',
list_id: '编号89757',
table: [
{id: 1, name: 'Rain', age: 22, mail: '[email protected]'},
{id: 2, name: '皮特', age: 24, mail: '[email protected]'},
{id: 3, name: '卡卡', age: 20, mail: '[email protected]'},
{id: 4, name: '戏戏', age: 26, mail: '[email protected]'},
{id: 5, name: '一揪', age: 25, mail: '[email protected]'}
]
};
// 附上模板
$("#result1").setTemplateElement("template");
// 给模板加载数据
$("#result1").processTemplate(data);
});
</script>
<!-- 模板内容 -->
<textarea id="template" style="display:none">
<strong>{$T.name} : {$T.list_id}</strong>
<table>
<tr>
<th>编号</th>
<th>姓名</th>
<th>年龄</th>
<th>邮箱</th>
</tr>
{#foreach $T.table as record}
<tr>
<td>{$T.record.id}</td>
<td>{$T.record.name}</td>
<td>{$T.record.age}</td>
<td>{$T.record.mail}</td>
</tr>
{#/for}
</table>
</textarea>
=================
$T表示什么呀??
作者: caojiayin198 发布时间: 2009-04-24
搜索 jTemplates,
官方有介绍, $T应该是 数据 data 吧
官方有介绍, $T应该是 数据 data 吧
作者: cssrain 发布时间: 2009-04-29
用php给的模板 {$T.record.id} 就是取数据的撒
作者: loveyouyk 发布时间: 2009-06-01
哇撒,强大.
作者: pader 发布时间: 2009-06-04
热门阅读
-
office 2019专业增强版最新2021版激活秘钥/序列号/激活码推荐 附激活工具
阅读:74
-
如何安装mysql8.0
阅读:31
-
Word快速设置标题样式步骤详解
阅读:28
-
20+道必知必会的Vue面试题(附答案解析)
阅读:37
-
HTML如何制作表单
阅读:22
-
百词斩可以改天数吗?当然可以,4个步骤轻松修改天数!
阅读:31
-
ET文件格式和XLS格式文件之间如何转化?
阅读:24
-
react和vue的区别及优缺点是什么
阅读:121
-
支付宝人脸识别如何关闭?
阅读:21
-
腾讯微云怎么修改照片或视频备份路径?
阅读:28