菜单切换
FACESOHO知行者
心灵
记录
远方
赞赏工具
源代码:
点击运行
保存
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>jquery.tmpl.min.js facesoho知行者</title> <script src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.8.0.js"></script> <script src="http://ajax.microsoft.com/ajax/jquery.templates/beta1/jquery.tmpl.min.js"></script> <script type="text/javascript"> $(function () { var temp = [ { Name: "blue", explain: "蓝色" }, { Name: "red", explain: "红色" }, { Name: "yellow", explain: "黄色" } ]; $("#tempList").html($("#tempTemplate").tmpl(temp)); }) </script> </head> <body> <ul id="tempList">请稍后......</ul> <script id="tempTemplate" type="text/x-jquery-tmpl"><li><b>${Name}</b> (${explain})</li></script> </body> </html>
运行结果