[Javascript] DOM navigation
Peter Brunone
peter at brunone.com
Wed Jun 2 12:02:46 CDT 2004
What about
document.getElementById('myDiv').firstChild.rows[rowIndex].cells[cellInd
ex] ?
Can somebody confirm whether or not the rows and cells
collections are w3c standard? I use 'em all the time in IE, but that's
not saying much...
Of course, you could put an ID on the <table> and not have to
ref the DIV at all (or even put IDs on the appropriate <td> tags)...
Cheers,
Peter
-----Original Message-----
From: javascript-bounces at LaTech.edu
[mailto:javascript-bounces at LaTech.edu] On Behalf Of Gee, David
document.getElementById('myDiv').getElementsByTagName("TD")[0]
That should work, and is a tad more elegant, I guess...
David
-----Original Message-----
From: Paul Cowan [mailto:dagda1 at hotmail.com]
Hi,
I have a DIV which contains a table, which contains a row, which
contains a
column.
<div id='myDiv'>
<table>
<tbody>
<tr>
<td>
Is there a better way of selecting this using the DOM other than saying:
o =
document.getElementById('myDiv')firstChild.firstChild.firstChild.firstCh
ild;
Thanks
Paul
More information about the Javascript
mailing list