<!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>
<h3>Using {{if}} and {{else}} to render conditional sections.</h3> <script type="text/x-jsrender" id="movieTemplate">
<tr>
<td>{{>title}}</td>
<td>{{if languages}}
Alternative languages:<em>{{>languages}}</em>
{{else subtitles}}
Original language only...
<br />
subtitles in <em>{{>subtitles}}</em>
{{else}}
Original version only, without subtitles.
{{/if}}</td>
</tr>
</script> <script type="text/javascript">
var movies = [
{
title: "Meet Joe Black",
languages: "English and French",
subtitles: "English"
},
{
title: "Eyes Wide Shut",
subtitles: "French and Spanish"
},
{
title: "The Mighty"
},
{
title: "City Hunter",
languages: "Mandarin and Chinese"
}
]; $("#movieList").html($("#movieTemplate").render(movies));
</script>
   </body>
</html>

  

JsRender系列demo(4)-if else的更多相关文章

  1. JsRender系列demo(9)自定义函数

    <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <m ...

  2. JsRender系列demo(7)compline

    <!DOCTYPE html> <html> <head> <script src="http://code.jquery.com/jquery.j ...

  3. JsRender系列demo(6)-无名

    <!DOCTYPE html> <html> <head> <script src="http://code.jquery.com/jquery.j ...

  4. JsRender系列demo(5) for else

    <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <m ...

  5. JsRender系列demo(3)-自定义容器

    <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <m ...

  6. JsRender系列demo(2)多模板-template

    <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <m ...

  7. JsRender系列demo(1)-insert-data

    <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <m ...

  8. JsRender系列-11

    <!DOCTYPE html> <html> <head> <script type="text/javascript" src=&quo ...

  9. JsRender系列demo-10

    <!DOCTYPE html> <html> <head> <script src="http://code.jquery.com/jquery.j ...

随机推荐

  1. 《Linux shell编程中 diff与vimdif的使用》RHEL6

    linux比较2个文件的区别有两个命令: (1)diff (2)vimdiff cp /etc/grub.conf hello 在hello文件的末尾添加zhangsan 使用diff比较2个文件的区 ...

  2. web前端学习之HTML CSS/javascript之一

    前端编码之路之坎坷,web前端应该一直是个战场吧,各种浏览器的不兼容,各种小细节的修改,要往一个好的产品经理方向走,实在是难,昨天听了一位十年经验的产品经理讲座,最重要的恐怕就是协调资源的能力,而协调 ...

  3. ios特性访问器方法(setter和getter)

    Employee.h @interface Employee:NSObject { int _employeeNumber; NSString *_name; Employee*_supervisit ...

  4. R语言基础(二) 可视化基础

    > which.max(apply(x[c("x1","x2","x3")], 1, sum))49 > x$num[which ...

  5. 用Python作GIS之四:Tkinter基本界面的搭建

    Python下的主窗口可以定义如下:def start(self):        #self.project = Project("temp")        #self.pro ...

  6. SQL统计——按照各种维度

    在SQLserver中可以按照各种维度进行统计,实现与EXCLE一样强大的功能. --========================== --Blog:<奔跑的金鱼> --Desc:&l ...

  7. Oracle定义两个变量,并对两个变量的值的长度进行判断

    这个例子其实很简单,但是往往简单的东西如果不用心就会漏洞百出,简单的一个逻辑判断,是为了给复杂逻辑判断做出铺垫 语法格式: if<condition_expression> then pl ...

  8. [SQL_Server_Question]Msg 1105无法为数据库 'tempdb' 中的对象分配空间,因为 'PRIMARY' 文件组已满

    错误消息: Msg 1105, Level 17, State 2, Line 266Could not allocate space for object 'dbo.Large Object Sto ...

  9. VB数据库经典实例总结(一)

    先让大家看一张图.随后讲解..... 敲完五个例子之后的心情是非常好的.并没有想象中的那么难,深究它的话大致思路就是.: 建立数据库 --->利用VB导出数据 --->供人们使用.. 因为 ...

  10. creating indexing for SQL tunning

    1. Not so long time ago, I got a report from customer. It's reported that they had a report getted v ...