⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 jst_demo.html.txt

📁 刚开始学习看的
💻 TXT
字号:
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title> Swato JavaScript Template Demo </title>
<script type="text/javascript" src="jslib/swato-jst.js"></script>
<script type="text/javascript">
	var data = {
		products : [{ name: "mac", desc: "computer",     
						price: 1000, quantity: 100, alert:null },
					{ name: "ipod", desc: "music player", 
						price:  200, quantity: 200, alert:"on sale now!" },
					{ name: "cinema display", desc: "screen",       
						price:  800, quantity: 300, alert:"best deal!" } ],
		customer : { first: "John", last: "Public", level: "gold" }
	};

	execute=function() {
		result=JSTemplate.process(document.getElementById("cart_jst").value, data);
	    document.getElementById("outPutDiv").innerHTML = result;
	}
</script>
</head>

<body>
<textarea id="cart_jst" rows="20" cols="80">
<!--begin
	Hello <%customer.first%> <%customer.last%>.<br/>
	Your shopping cart has <%products.length%> item(s):
	<table border=1>
	<tr><td>Name</td><td>Description</td>
		<td>Price</td><td>Quantity & Alert</td></tr>
#for (i in products) {
#	var p=products[i];
	<tr><td><%p.name.toUpperCase()%></td><td><%p.desc%></td>
	<td>$<%p.price%></td><td><%p.quantity%> : <%p.alert%></td>
	</tr>
#}
	</table>
#if(customer.level == "gold") {
      We love you!  Please check out our Gold Customer specials!
#}else{
      Become a Gold Customer by buying more stuff here.
#}
end-->
</textarea>
<input type="button" value="execute" onclick="execute();"/>
<div id="outPutDiv"></div>
</body>
</html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -