Click to See Complete Forum and Search --> : parentElement problem


pelegk1
05-19-2003, 12:20 AM
this code work ok : (this is xsl
<td style='cursor: hand' onclick="WorkingHour(this.parentElement)">
<table>
<tr>
<td align="Right">
<IMG SRC="Images/ServiceList/med015.gif" alt="{normalize-space(servName)}"></IMG>
</td>
</tr>
</table>
</td>

but when i do :

<td >
<table>
<tr>
<td align="Right" style='cursor: hand' onclick="WorkingHour(this.parentElement)" >
<IMG SRC="Images/ServiceList/med015.gif" alt="{normalize-space(servName)}"></IMG>
</td>
</tr>
</table>
</td>
as u may see i moved the first code td into the second TD!
the problem is that when i do this.parentElement it inst working!
i tried to do : this.parentElement.parentElement and it didnt help too!
what to do?

skriptor
05-19-2003, 02:48 AM
Hi,
i think your second example will work, if you use 5 (!) parentElement.

The document tree for a table looks like
table
tbody
tr
td

if you want to access the tr-element of the first table you should use
this.parentElement.parentElement.parentElement.parentElement.parentElement

Good luck, skriptor

khalidali63
05-19-2003, 09:40 AM
You should avoid using

"parentElement"

as its only IE specific.

replace it with

"parentNode"
which is part of w3c's DOM standards recomendation