innerHTML on TABLE and TR (IE)

js/ajax - 13/03/2007 @ 1:32



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.

fuck ie


9 Responses to “innerHTML on TABLE and TR (IE)”

WilliamNo Gravatar says on

TR innerHTML problem in IE.
table.tr.innerHTML = “namexxxx”; works in Firefox, but doesn’t work in IE.

Quick solution:
var table = document.getElementById(”yourtable”);
var rows = table.rows;

if(document.all) {
rows[0].swapNode(rows[1]); //
} else {
var t = rows[0].innerHTML;
rows[0].innerHTML = rows[1].innerHTML;
rows[1].innerHTML = t;
}

BaldoNo Gravatar says on

thanks william!

RajaNo Gravatar says on

William your solution is good.
but i have to set a new content as the innerHTML and not to swap the rows. How can i do that.the else part in your code throws the unknown runtime exception.Please help

WilliamNo Gravatar says on

To solve “tr.innerHTML” doesn’t work in IE , below code works in firefox and IE
—————————————-
var otab = document.getElementById(”tab_me”); // you must specify table id.
var str = “”;
for(i=0; i< otab.rows[0].cells.length; i++) {
otab.rows[0].cells[i].innerHTML = “new content here”;
str += otab.rows[0].cells[i].innerHTML + “\n”;
}
alert(str);

diet plansNo Gravatar says on

Dopo aver ricevuto una segnalazione da parte di VideoMarta – un blog molto interessante in cui una ragazza espone le sue considerazioni

green teaNo Gravatar says on

Sito che ho fatto per mia sorella aver ricevuto una segnalazione da parte di VideoMarta.

wineNo Gravatar says on

Well the information was reallly appreaciable thanks for sharing information thanks for post.
Regards,
Thomos – wine

Auto Insurance QuotesNo Gravatar says on

Dopo aver ricevuto una segnalazione da parte di VideoMarta – un blog molto interessante in cui una ragazza espone le sue considerazioni

Quadrant vansNo Gravatar says on

You can try.
function escapeHTML(someText) {
var div = document.createElement(’div’);
var text = document.createTextNode(someText);
div.appendChild(text);
return div.innerHTML;
}

Commenta | Leave a Reply

CommentLuv Enabled
***