0
在运行时添加淘汰赛模板清空HTML DOM在运行时添加淘汰赛模板清空HTML DOM
var templateEngine = new ko.nativeTemplateEngine();
templateEngine.addTemplate = function (templateName, templateMarkup) {
document.write("<script type='text/html' id='" + templateName + "'>" + templateMarkup + "<" + "/script>");
};
templateEngine.addTemplate("gridTable","<table></table");
所有较早的内容,去和DOM成为
<html><head><script type="text/html" id="gridView"><table></table></script></head></html>
https://developer.mozilla.org/en-US/docs/Web/API/Document/write:在关闭的(加载的)文档上调用'document.write' **会自动调用'document.open',它将清除文件** – nemesv 2015-03-25 07:44:20