Thanks, Chris - my top two <TD> tags on that level are empty. Funny that
FrontPage preview didn't bomb out on that. Serves me right for using FP!
The DOM navigation looks easier. Perhaps a little too advanced for me at
the moment (I'm a self-taught programmer & a biologist!)...
Cheers
Andrew
> Hi Andrew,
> To be more specific about the problem:
>
> "alert(Table1.childNodes[0].childNodes[x+1].childNodes
> [3].nodeType);"
> gives a response of "1" (one more level should reach the textNode)
>
> "alert(Table1.childNodes[0].childNodes[x+1].childNodes
> [3].childNodes.nodeType);"
> gives a response of "undefined" (understandably)
>
> "alert(Table1.childNodes[0].childNodes[x+1].childNodes
> [3].childNodes[0].nodeType);"
> gives no response. The script will stop at this point.
If the <td> is empty, it will have no text node & therefore bomb out when
you try to access it, you could check for this using something like...
if(Table1.childNodes[0].childNodes[x+1].childNodes[3].childNodes.length >
0)
before accessing it.
> Is there another way of navigating the table with Javascript?
Yep, you can use the DOM...
var loRows=Table1.getElementsByTagName("TR");
for(var a=0; a<loRows.length; a++){
var loCells=loRows.item(a).getElementsByTagName("TD");
for(var b=0; b<loCells.length; b++){
do something with the tds here
}
}
HTH,
Chris