新聞中心
這里有您想知道的互聯(lián)網(wǎng)營銷解決方案
jQueryTemplate的用法
Javascript代碼中不要包含HTML:
創(chuàng)新互聯(lián)-專業(yè)網(wǎng)站定制、快速模板網(wǎng)站建設(shè)、高性價(jià)比師宗網(wǎng)站開發(fā)、企業(yè)建站全套包干低至880元,成熟完善的模板庫,直接使用。一站式師宗網(wǎng)站制作公司更省心,省錢,快速模板網(wǎng)站建設(shè)找我們,業(yè)務(wù)覆蓋師宗地區(qū)。費(fèi)用合理售后完善,十余年實(shí)體公司更值得信賴。
var div = document.getElementById("my-div"); div.innerHTML = "Error
Invalid e-mail address.
";
在Javascript代碼中完全隔絕HTML很難,這一點(diǎn)可以根據(jù)實(shí)際情況來權(quán)衡使用。Javascript 模版技術(shù)就是一種有效隔離HTML和Javascript代碼的手段,如下是jQuery Template的用法:
// HTML// Javascript// Create an array of booksvar books = [{ title: "ASP.NET 4 Unleashed", price: 37.79, picture: "AspNet4Unleashed.jpg" }];// Render the books using the template$("#bookTemplate").tmpl(books).appendTo("#bookContainer"); function formatPrice(price) { return "$" + price.toFixed(2); }
當(dāng)前標(biāo)題:jQueryTemplate的用法
本文來源:http://www.dlmjj.cn/article/gpjeep.html