JsRender系列demo(5) for else
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title></title>
<script type="text/javascript" src="scripts/jquery.js"></script>
<script type="text/javascript" src="scripts/jquery-ui.js"></script>
<script type="text/javascript" src="scripts/jsrender.js"></script>
<link href="scripts/demos.css" rel="stylesheet" />
<link href="scripts/movielist.css" rel="stylesheet" />
</head>
<body>
<script id="movieTemplate" type="text/x-jsrender">
<tr>
<td>{{:title}}</td>
<td>{{for languages}}
<div class="{{:#index%2 ? 'even' : 'odd'}}"></div>
<em>{{:name}}</em>
{{else}}
No alternate languages!
{{/for}}</td>
</tr>
</script>
<h2>Using {{for}} to render hierarchical data - inline nested template.</h2>
<table>
<thead>
<tr>
<th>title</th>
<th>movieList</th>
</tr>
</thead>
<tbody id="movieList"></tbody>
</table> <script type="text/javascript">
var movies = [
{
title: "Meet Joe Black",
languages: [
{ name: "English" },
{ name: "French" }
]
},
{
title: "Eyes Wide Shut",
languages: [
{ name: "French" },
{ name: "Mandarin" },
{ name: "Spanish" }
]
},
{
title: "The Inheritance",
languages: [
{ name: "English" },
{ name: "German" }
]
},
{
title: "Local Story",
languages: []
},
{
title: "My Home Video"
}
];
$("#movieList").html($("#movieTemplate").render(movies));
</script>
</body>
</html>
JsRender系列demo(5) for else的更多相关文章
- JsRender系列demo(9)自定义函数
<!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <m ...
- JsRender系列demo(7)compline
<!DOCTYPE html> <html> <head> <script src="http://code.jquery.com/jquery.j ...
- JsRender系列demo(6)-无名
<!DOCTYPE html> <html> <head> <script src="http://code.jquery.com/jquery.j ...
- JsRender系列demo(4)-if else
<!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <m ...
- JsRender系列demo(3)-自定义容器
<!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <m ...
- JsRender系列demo(2)多模板-template
<!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <m ...
- JsRender系列demo(1)-insert-data
<!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <m ...
- JsRender系列-11
<!DOCTYPE html> <html> <head> <script type="text/javascript" src=&quo ...
- JsRender系列demo-10
<!DOCTYPE html> <html> <head> <script src="http://code.jquery.com/jquery.j ...
随机推荐
- C语言 电梯函数
#include <stdio.h> #include <time.h> #include <stdlib.h> void test(){//汉字输出 printf ...
- 【风马一族_xml】xml语法
xml语法 文档声明 用来声明xml的属性,用来指挥解析引擎如何去解析当前xml 通常一个xml都要包含并且只能包含一个文档声明 xml的文档必须在整个xml的最前面,在文档声明之前不能有任何内容 & ...
- linux下配置tomcat7 + solr4.9(续)--- 多核索引的配置
在上一篇文章中(详见http://www.cnblogs.com/bxljoy/p/3850263.html),我们已经介绍了tomcat+solr的索引服务器的配置,但是文中创建的服务器只能支持存储 ...
- LLVM language 参考手册(译)(2)
调用约定(Calling Conventions) LLVM functions, calls and invokes 可以带有一个可选的调用约定来指明调用方式.每一对 caller/callee(调 ...
- python杂记-5(装饰器)
1.被装饰的函数有参数(一个参数): def w1(func): def inner(arg): # 验证1 # 验证2 # 验证3 return func(arg) return inner @w1 ...
- mac常用设置
1.修改mac主机名 系统偏好设置->共享->电脑名称 ,编辑就可以了. sudo scutil --set HostName hostname 这个是修改主机名 sudo scutil ...
- GITHUB 提交错误 Error: Permission denied (publickey) 解决
1. 在开发机上生成自己的密钥 ssh-keygen -b 1024 -t rsa -b 指密钥对长度 -t 指加密方式 Enter file in which to save the key ( ...
- ActiveMQ之TemporaryQueue和TemporaryTopic
TemporaryQueue和TemporaryTopic,从字面上就可以看出它们是“临时”的目的地.可以通过Session来创建,例如: TemporaryQueue replyQueue = se ...
- 8、WPF体系架构和运行机制
体系架构:http://msdn.microsoft.com/zh-cn/library/ms750441.aspx 运行机制:http://www.cnblogs.com/leep2007/arch ...
- Linux下Hadoop的简单安装
Hadoop 的安装极为简单,一共只有三步: 安装JDK 安装Hadoop 配置Hadoop 1,安装JDK 下载JDK,ftp传到linux或者linux中下载 切换 ...