解决ie下table,tr,td等的innerHTML只读问题
innerHTML:
The property is read/write for all objects except the following, for which it is read-only: COL, COLGROUP, FRAMESET, HTML, STYLE, TABLE, TBODY, TFOOT, THEAD, TITLE, TR.
TR innerHTML problem in IE.
在ie下,对于COL, COLGROUP, FRAMESET, HTML, STYLE, TABLE, TBODY, TFOOT, THEAD, TITLE, TR,innerHTML属性是只读的。也就是说你不能通过innerhtml对这些标签进行操作。
方法一:利用td支持innerHTML为他们添加,你可以仿照下面的例子为你需要的标签添加
table.tr.innerHTML = “namexxxx”; works in Firefox, but doesn’t work in IE.
Quick solution:
document.getElementById(”yourtable”).firstChild=’’;