I saw that the others has answered you. Let me add my two eurocents
;-)
You could have use the ID attributes in those two tables :
<table ...>
<tr>
<td>
<table id=3D"mytable1" ...>
...
</table>
<td>
<table id=3D"mytable2" ...>
...
</table>
</table>
Then in JS, you just need to write:
var Table1 =3D document.getElementById("mytable1")
var Table2 =3D document.getElementById("mytable2")
Using these absolute references, no matter how you move your tables
later or add some columns between them or whatever, they're still the
same.
You don't have to change the numbers as you would have to in your
present
code.
OTOH, I saw that sometimes you wrote table1, sometimes Table1. Be
careful, JS is case-sensitive.
> -----Message d'origine-----
> De : Christine_Sun@c...
> [mailto:Christine_Sun@c...]
> Envoy=C3=A9 : mardi 21 janvier 2003 21:19
> =C3=80 : javascript
> Objet : [javascript] how to refer to child table in javascript
>
>
> Hi,
>
> I have two tables. In order to put them parallel to each
> other, I created a
> main table. So the first table is within the first <td> of
> the main table,
> And the 2nd table is within the 2nd <td> of the main table.
>
> In javascript, I have
> Var table1, table2;
> Table1 =3D element.tBodies(0).children(0).children(0);
> Table2 =3D element.tBodies(0).children(0).children(1);
>
> But then how do I get the head and body of the child tables?
>
> Table1.element.tHead or table1.tHead wouldn't work.
>
> Any suggestions?
>
> Thanks very much in advance.
>
> Christine
>