[Javascript] Re: How to make IE display changes to DOM tree?
Matthew Palmer
mpalmer at hezmatt.org
Mon Dec 13 03:30:18 CST 2004
On Sun, Dec 12, 2004 at 10:33:47PM -0600, Peter Brunone wrote:
> I tried your script and it didn't work for me either. For what
I found the problem: The IE DOM adds an extra level of object inside the
TABLE -- TBODY. You need to appendChild to the TBODY, not the TABLE. So,
for instance:
row = document.createElement('TR');
tbl = document.getElementById("DynamicTable");
// Mozilla-compatible
tbl.appendChild(row);
// But for IE:
tbl.childNodes.item(0).appendChild(row);
> it's worth, when I want to add table rows in IE, I use the insertRow()
> and insertCell() methods of the table and tr, respectively. You can
Son of a *****! It's not even IE-specific -- it's in the W3C HTML DOM
version 2. Aaaargh!
Thanks for the pointer, Peter -- I've found the relevant spec now, so
hopefully I should be able to write things a little simpler from now on...
Does anyone have any recommendations for good, up-to-date books or sites for
all this sort of thing? The W3C specs, whilst good, aren't exactly the most
approachable sorts of things...
- Matt
--
"Riding through the tunnel at 200 is something you should approach in the
same way you'd bonk your neighbours wife. A once in a while thing. Do it
often and you'll get caught."
-- Kel, aus.moto
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.evolt.org/pipermail/javascript/attachments/20041213/3bc71688/attachment.pgp>
More information about the Javascript
mailing list