Click to See Complete Forum and Search --> : Confusion with the DOM


ZeRhino
12-24-2002, 03:32 AM
I'm trying to make a script where the user can mouseOver a link that is in a small table cell become highlighted by changing the td bgcolor, I'm not sure, does the DOM support a table object, I couldn't find the answer, this is the non-working code


<table name="table1" width="100" border="1">

<tr>
<td name="td1" ><a href="#" onMouseOver="document.table1.td1.bgColor=999999;" >Link1</a></td>
</tr>

swon
12-24-2002, 06:30 AM
Use instead of the name attribute the Id. for example:

<table id="tab1">
<tr>
<td id="tab1td1"><a href="#" onMouseOver='document.getElementById("tab1td1").bgColor=999999'>Link1</a></td>
</tr>
</table>

ZeRhino
12-24-2002, 09:57 AM
Thanks that works perfectly.