function insRow(){
document.getElementById("rowId").value=parseInt(document.getElementById("rowId").value)+1;
var rowId = document.getElementById("rowId").value;
var tb1 = document.getElementById("ctable");
var rowsCount=tb1.rows.length;
var row = tb1.insertRow(rowsCount);
var cell = row.insertCell(0);
cell.innerHTML="<img src=\"<%=contextPath%>/img/update.gif\" class=\"nav\" />";
var cell = row.insertCell(1);
cell.innerHTML="<input name=\"companyname"+rowId+"\" ID=\"companyname"+rowId+"\" type=\"text\" />";
var cell = row.insertCell(2);
cell.innerHTML="<input name=\"companynameen"+rowId+"\" ID=\"companynameen"+rowId+"\" type=\"text\" />";
}
变态的IE
//div.appendChild(eleTable);
//div.insertBefore(temp,null);
//div.appendChild(temp);
本文介绍了一种在网页中动态生成表格并解决IE浏览器兼容性问题的方法,包括使用JavaScript操作DOM元素,实现表格行的动态插入,并针对IE进行优化。
942

被折叠的 条评论
为什么被折叠?



