View Full Version : can't use getElementById on <tbody> in IE

03-23-2006, 06:44 AM
I can't use getElementById on <tbody> in IE for some reason, anyone know why? I have also tried:


does anyone know a slick way to add content to a existing table? i am passing <tr> blocks back from php to javascript using sajax.

it works perfect in firefox

the reason why i don't pass the entire tab back each time is because each of the columns is sortable

here is my table:

<div id="datExample">
<table class="dynatab" id="workshopQueryTable" border="0">
<th colspan="2" align="center"><font style="font-size:.8em !important; text-align:center">Times are in 24 hour format.</font></th>
<th colspan="6"> </th>
<tr class="yellow" id="workshopQueryHeader">
<th class="sortable">Date</th>
<th class="sortable">Start&nbsp;Time</th>
<th class="sortable">End&nbsp;Time</th>
<th class="sortable">Venue</th>
<th class="sortable">Address</th>
<th class="sortable">City</th>
<th class="sortable">State</th>
<th class="sortable">Zip</th>
<th class="sortable">ID</th>
<tbody id="workshopQueryContent">

here is the javascript that works in mozilla but not IE:

function printTable(result) {
document.getElementById("workshopQueryContent").innerHTML = result;

03-23-2006, 08:40 AM
TBODY is a requested table's element in javascript, so that it will vitually exists even it is not HTML written. So that in fact your TBODY is the second one in the table, not the first. Try:


03-23-2006, 03:45 PM
so now I know I am sitting in the right place with your code, IE recognizes I am on the right tag in the HTML

returns workshopQueryContent

but it still will not take a .innerHTML in IE, in firefox once again it loads beautifully, any ideas?

03-23-2006, 05:32 PM
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.