function setting(gk){
//建立dom对象
xmlDoc = new ActiveXObject('Microsoft.XMLDOM');
//设置是否同步
xmlDoc.async = false;
//加载文档
xmlDoc.load("setting.xml");
//创建根元素节点
var obj = document.createElement("table");
var tbody = document.createElement("tbody");
//根据参数gk得到其子节点的元素个数
var n = xmlDoc.getElementsByTagName(gk)[0].childNodes;
//根据其长度遍历其所有的子节点
for(var i=0;i<n.length;i++){
//得到子节点的名字
var name=xmlDoc.getElementsByTagName(gk)[0].childNodes(i).nodeName;
//得到子节点的name属性的值
var values=xmlDoc.getElementsByTagName(gk)[0].childNodes(i).getAttribute('name');
//以每行三列的方式来布局
if((i+1)==1||(i+1)==4||(i+1)==7||(i+1)==10||(i+1)==13||(i+1)==16||(i+1)==19||(i+1)==22||(i+1)==25||(i+1)==28||(i+1)==31||(i+1)==34||(i+1)==37||(i+1)==40||(i+1)==43||(i+1)==46||(i+1)==49||(i+1)==52||(i+1)==55||(i+1)==58){
//创建节点
var tr = document.createElement("tr");
var td = document.createElement("td");
//添加属性
td.setAttribute("noWrap","true");
td.setAttribute("width","12.5%");
td.setAttribute("class","content_field");
td.innerText = values;
var tds = document.createElement("td");
tds.setAttribute("noWrap","true");
tds.setAttribute("width","25%");
var input = document.createElement("input");
input.setAttribute("id",name);
input.setAttribute("type","text");
input.setAttribute("size","8");
input.setAttribute("style","font-weight:bold");
input.setAttribute("value","<fmt:formatNumber value='${ajjc452Value.BZJS}' pattern='0.00000'/>");
input.setAttribute("readOnly","true");
//子节点添加到父节点
tds.appendChild(input);
tr.appendChild(td);
tr.appendChild(tds);
}else if((i+1)==3||(i+1)==6||(i+1)==9||(i+1)==12||(i+1)==15||(i+1)==18||(i+1)==121||(i+1)==24||(i+1)==27||(i+1)==30||(i+1)==33||(i+1)==36||(i+1)==39||(i+1)==42||(i+1)==45||(i+1)==48||(i+1)==51||(i+1)==54||(i+1)==57||(i+1)==60) {
var td = document.createElement("td");
td.setAttribute("noWrap","true");
td.setAttribute("width","12.5%");
td.setAttribute("class","content_field");
td.innerText = values;
var tds = document.createElement("td");
td.setAttribute("noWrap","true");
tds.setAttribute("width","25%");
var input = document.createElement("input");
input.setAttribute("id",name);
input.setAttribute("type","text");
input.setAttribute("size","8");
input.setAttribute("style","font-weight:bold");
input.setAttribute("value","<fmt:formatNumber value='${ajjc452Value.BZJS}' pattern='0.00000'/>");
input.setAttribute("readOnly","true");
tr.appendChild(td);
tr.appendChild(tds);
tds.appendChild(input);
}else{
var td = document.createElement("td");
td.setAttribute("noWrap","true");
td.setAttribute("width","12.5%");
td.setAttribute("class","content_field");
td.innerText = values;
var tds = document.createElement("td");
td.setAttribute("noWrap","true");
tds.setAttribute("width","25%");
var input = document.createElement("input");
input.setAttribute("id",name);
input.setAttribute("type","text");
input.setAttribute("size","8");
input.setAttribute("style","font-weight:bold");
input.setAttribute("value","<fmt:formatNumber value='${ajjc452Value.BZJS}' pattern='0.00000'/>");
input.setAttribute("readOnly","true");
tds.appendChild(input);
tr.appendChild(td);
tr.appendChild(tds);
}
tbody.appendChild(tr);
}
obj.setAttribute("class","normal1_table");
obj.setAttribute("cellSpacing","1");
obj.setAttribute("cellPadding","4");
obj.setAttribute("width","100%");
obj.setAttribute("align","center");
obj.setAttribute("height","450");
obj.setAttribute("border","0");
obj.appendChild(tbody);
//把根节点添加到指定的Form中
document.all.frm.appendChild(obj);}
评论