Table id= "zhutitable" html2= "<tr></tr>", Data settableinnerhtml (document.getElementById (' zhutitable '), HTML2);
function
setTableInnerHTML(table, html) {
//table 为table对象,html为生成的html字符串
if
(navigator && navigator.userAgent.match(/msie/i)) {
var
temp = table.ownerDocument.createElement(
‘div‘
);
temp.innerHTML =
‘<table>‘
+ html +
‘</table>‘
;
//注意此处传进来的html变量包含“<tbody></tbody>”标签 如果HTML变量中没有 则为 ‘<table><tbody>‘ + html + ‘</tbody></table>‘
table.replaceChild(temp.firstChild.firstChild, table.tBodies[0]);
//用生成的div中table的tbody替换原table中的tbody
Table.appendchild (Temp.firstChild.firstChild); Used to add TR to the generated table
}
else
{
table.innerHTML = html;
}
}
Get the tbody assignment in a table
var otbodydata = document.getElementById (' zhutitable '). Tbodies.item (0);
OTBODYDATA.INNERHTML+=HTML2;
Found to be under IE6-IE9, the innerHTML property of the following element table,thead,tfoot,tbody,tr,col,colgroup,html,title,style,frameset is read-only