turnitup wrote:[color=blue]
> Evertjan. wrote:[color=green]
> > turnitup wrote on 06 jun 2006 in comp.lang.javascript
:
> >[color=darkred]
> >> Given the id of a tr, does anyone know how to get a value of a td of
> >> that tr?[/color]
> >
> > <TD>s do not have a value.
> >
> > ========================================
> >
> > <table><tr id=myTr><td>blah</td></tr></table>
> > <script type='text/javascript'>
> > var r = document.getElementById('myTr').firstChild.innerHT ML
> > alert(r)
> > </script>
> >[/color]
>
> Thank you, of course I meant innerHTML!![/color]
Here's a longer version which just uses the DOM:
var r = document.getElementById('myTr').firstChild.firstCh ild.data
The second "firstChild" is the text node within the tr element that
contains "blah".
--
Kam-Hung Soh
http://kamhungsoh.blogspot.com - It Mostly Works
http://members.optusnet.com.au/khsoh - Software That Mostly Works