南郭之家
南郭大侠的blog ^_^

js控制ie里table的innerHTML

June 12th, 2009 by Titan

不知道算不算IE的bug,反正在firefox里面innerHTML是可写的,但是IE里面就是只读的。

今天碰到这个问题,用ajax替换表格的tbody内容的时候,ie里面报个错,不让替换了。后来在table外面套个div,对整个div的innerHTML替换就ok了

上代码:

stationGoodsDiv.innerHTML = "<table id='stationGoodsTable' style='width:100%'><tr id='stationGoodsTableHeader'>" + stationGoodsTableHeader.innerHTML + "</tr>" + xmlHttp.responseText + "</table>";

Posted in 随想

Leave a Comment

Please note: Comment moderation is enabled and may delay your comment. There is no need to resubmit your comment.