js动态创建Html表格
function createTable(rowNum,cellNum) {
var newtable = document.getElementById("newtable");
for (var i = 0; i < rowNum; i++) {
var rows = newtable.insertRow(i);
for (var k = 0; k < cellNum; k++) {
var cells = rows.insertCell(k);
cells.style.textAlign="center";
cells.style.border="#d2d2d2 solid 1px";
cells.style.backgroundColor="white";
cells.style.width="172px";
cells.style.height="47px";
cells.id = "cell"+i+k;
var ipt = document.createElement("input");
ipt.setAttribute("type","text");
ipt.style.width="172px";
ipt.style.height="47px";
ipt.style.textAlign="center";
ipt.style.border="#d2d2d2 solid 1px";
ipt.placeholder = "可手动输入";
ipt.id="inputIdx"+i+k;
cells.appendChild(ipt);
}
}
}