jQuery Template and Data Linking

http://weblogs.asp.net/scottgu/archive/2010/05/07/jquery-templates-and-data-linking-and-microsoft-contributing-to-jquery.aspx

 

<!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>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
<script type="text/javascript" src="jquery-1.4.2.js"></script>
<script type="text/javascript" src="jquery.tmpl.js"></script>
<script type="text/javascript">
$(function(){ 

var contacts=
	[
		{ name:"dannis wu吴1",phone:"10733-13453"},
		{ name:"dannis wu吴2",phone:"20733-13453"},
		{ name:"dannis wu吴3",phone:"30733-13453"},
		{ name:"dannis wu吴4",phone:"40733-13453"}
	];
	$("#productTemplate").render(contacts).appendTo("#dvContainer");

 });


</script>
</head>

<body>
<div id="dvContainer"></div>

<script id="productTemplate" type="text/html">
<div style="border:solid 1px red" >
Name: {{= name}} <br>
phone: {{= phone}}  <!--注意=号与 phone 之间一定要有一个空格-->
</div>
</script>

</body>
</html>

 

jQuery Templates, Data Link, and Globalization Accepted as Official jQuery Plugins

 

http://weblogs.asp.net/scottgu/archive/2010/10/04/jquery-templates-data-link-and-globalization-accepted-as-official-jquery-plugins.aspx

 

posted @ 2010-11-03 12:30  庚武  Views(602)  Comments(0Edit  收藏  举报