日期:2014-05-16 浏览次数:20445 次
function loadXML(url)
{
var xmldoc = null;
if (document.implementation && document.implementation.createDocument)
{
xmldoc = document.implementation.createDocument("","",null);
xmldoc.async = false;
xmldoc.load(url);
}
else if(window.ActiveXObject)
{
xmldoc = new ActiveXObject("Microsoft.XMLDOM");
xmldoc.async = false;
xmldoc.load(url);
}
if (xmldoc != null)
{
if (xmldoc.parseError.errorCode != 0)
{
alert(xmldoc.parseError.reason);
return null;
}
}
return xmldoc;
}
function makeBuildHtmlContent(type)
{
//写构建步骤那块
var xmldoc = loadXML("SCRequestCfg.xml");
if (xmldoc == null)
{
alert("Load Xml failed\n");
return null;
}
var root = null;
root = document.getElementById(type);
if(root == null)
{
alert("load build root failed\n");
return null;
}
var table = document.createElement('table');
table.setAttribute("border","1");
root.appendChild(table);
var header = table.createTHead();
var headerrow = header.insertRow(0);
headerrow.insertCell(0).appendChild(document.createTextNode("构建名称"));
headerrow.insertCell(1).appendChild(document.createTextNode("权限级别"));
headerrow.insertCell(2).appendChild(document.createTextNode("预估耗时"));
headerrow.insertCell(3).appendChild(document.createTextNode("超时时间"));
headerrow.insertCell(4).appendChild(document.createTextNode("是否涉及加壳"));
......//后面的逻辑就不写了 就是更具xml里的内容动态创建一个表格
}
<body onload="makeBuildHtmlContent('safebox_build_steps_all')">
<div id="wrapper">
<div id="safebox_build_steps_all">