首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > JavaScript >

javascript模板发动机PURE

2012-11-25 
javascript模板引擎PURE现在有许多javascript模板引擎和服务器端的freemarker那些很像,定义模板像下面:te

javascript模板引擎PURE
现在有许多javascript模板引擎和服务器端的freemarker那些很像,定义模板像下面:

<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> 
感觉对html改动较大,pure就不一样了,对美工做的html影响很小。看下面一个例子:
<html><head><title>PURE Unobtrusive Rendering Engine</title><script src="../libs/jquery.js"></script><script src="../libs/pure.js"></script>  <style>    .even td { background : #DDD }    .odd  td { background : #FFF }  </style></head><body><div style="width:100%; height: 288px; overflow: auto;"><!-- HTML 模板 --><table id="mytb1" width="100%" border="0" cellspacing="0" cellpadding="0">  <tr onmouseover="$(this).addClass('highlight');" onmouseout="$(this).removeClass('highlight');"><td width="25%" />  

热点排行