zoukankan      html  css  js  c++  java
  • JsRender系列demo-10

    <!DOCTYPE html>
    <html>
    <head>
    	<script src="http://code.jquery.com/jquery.js" type="text/javascript"></script>
    	<script src="../../jsrender.js" type="text/javascript"></script>
    	<link href="../resources/demos.css" rel="stylesheet" type="text/css" />
    
    	<link href="../resources/movielist.css" rel="stylesheet" type="text/css" />
    </head>
    <body>
    <a href="../demos.html">JsRender Demos</a><br />
    
    <h3>Comparison tests</h3>
    
    <pre>
    {{if !(languages && languages.length)}}...{{/if}}
    
    {{if languages==null}}...{{/if}}
    </pre>
    
    <!--================ Demo ================-->
    
    <script id="movieTemplate" type="text/x-jsrender">
    	<tr>
    		<td>{{>title}}</td>
    		<td>
    			{{if !(languages && languages.length) tmpl="#messageTmpl"/}}
    		</td>
    		<td>
    			{{if languages==null tmpl="#messageTmpl"/}}
    		</td>
    	</tr>
    </script>
    
    <script id="messageTmpl" type="text/x-jsrender">
    	<b>Warning:</b> <em>No alternate languages</em>
    </script>
    
    <table>
    	<thead><tr><th>Title</th><th>{{if !(languages && languages.length)}}</th><th>{{if a==null}}</th></tr></thead>
    	<tbody id="movieList"></tbody>
    </table>
    
    <script type="text/javascript">
    	var movies = [
    		{
    			title: "Meet Joe Black",
    			languages: null
    		},
    		{
    			title: "The Mighty",
    			languages: []
    		},
    		{
    			title: "Eyes Wide Shut",
    			languages: [
    				{ name: "French" },
    				{ name: "German" },
    				{ name: "Spanish" }
    			]
    		}
    	];
    
    	$( "#movieList" ).html(
    		$( "#movieTemplate" ).render( movies )
    	);
    
    </script>
    
    </body>
    </html>
    

      

  • 相关阅读:
    yii框架中关于控制器中filter过滤器和外部action的使用
    关于开启url的pathinfo模式
    关于java的上转型对象
    linux下svn用法
    inode和文件描述符区别
    mysql字段更改操作命令
    c语言中的const的作用及解析
    C语言结构体--位域
    enum枚举型
    C语言结构体
  • 原文地址:https://www.cnblogs.com/alphafly/p/3888320.html
Copyright © 2011-2022 走看看