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


16 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;
}

International Flowers DeliveryNo Gravatar says on

This is really fantastic and remarkable one

Jane@Natural Skin CareNo Gravatar says on

helpful info, thanks

apple ipod softwareNo Gravatar says on

Hi, i feel that i saw you visited my internet web site therefore i came to ??return the favor??.I’m trying to find issues to improve my web-site!I suppose its ok to use several of your suggestions!!

villas in kissimmee floridaNo Gravatar says on

I wanted to thank you for this excellent read!! I definitely loved every little bit of it.Cheers for the info!!!! & This is the perfect blog for anyone who wants to know about this topic. You know so much its almost hard to argue with you ………
thanks

villas in kissimmee floridaNo Gravatar says on

cool…………………….:)

loquatNo Gravatar says on

Hi, guys, you can try outerHTML,

var t = “” + s + “”

var table = document.getElementById(”tab_0″);

if(document.all)
{
table.outerHTML = t;
}
else
{
table.innerHTML = s;
}

Commenta | Leave a Reply

CommentLuv Enabled
***