Click to See Complete Forum and Search --> : helpd needed with parentElement property!


pelegk1
05-18-2003, 05:05 AM
i have this html code :

<td >
<table>
<tr>
<!--מכון רנטגן-->
<td align="Right" style='cursor: hand' onclick="WorkingHour(this.parentElement)">
<IMG SRC="Images/ServiceList/leumitIcon.gif" alt="{normalize-space(servName)}"></IMG>
</td>
</tr>
</table>
</td>

the problem is that this.parentElement isnt correct and i need to reffer not to the inner <TR> (and i do this with parentElement), but i want to reffer to the "outer" <br> !!!
and i dont know how to go to step's above instead of 1!!!
i tried this.parentElement.parentElement and it didnt's work!
what to do?
thanks in advance
Peleg

khalidali63
05-18-2003, 05:48 AM
you should be able to get the parent bu using element.parentNode

and then keep using it until u get the parent you wanted.

first parent
tr = td.parentNode
table = tr.parentNode
ptd = table.parentNode

and so on..