JS动态画表格
JS动态画表格谁会啊?
我给他多少行和列的参数,他就显示多少行列的表格。。。
求帮忙!
------解决方案--------------------比较简单。动态生成行,生成列就行了。
var array = treeNode.memberUsers;
var table0 = document.getElementById("table0");
for ( var j = table0.rows.length-1; j > 0; j--) {
table0.deleteRow(j);
}
if(array.length<1){
var tr = document.createElement("tr");
var td0 = document.createElement("td");
td0.colSpan = 5;
var text0=document.createTextNode("<spring:message code="UserGroup.MsgNone"/>");
td0.appendChild(text0);
td0.setAttribute("align","center");
tr.appendChild(td0);
table0.appendChild(tr);
}
for ( var i = 0; i < array.length; i++) {
var tr = document.createElement("tr");
var td0 = document.createElement("td");
var text0=document.createTextNode(array[i].principal);
td0.appendChild(text0);
var td1 = document.createElement("td");
var text1=document.createTextNode(array[i].fullName);