www.webdeveloper.com
Results 1 to 3 of 3

Thread: parentElement problem

  1. #1
    Join Date
    Jan 2003
    Location
    Israel
    Posts
    1,381

    parentElement problem

    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?

  2. #2
    Join Date
    Feb 2003
    Posts
    85
    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

  3. #3
    Join Date
    Dec 2002
    Location
    Calgary, Canada
    Posts
    2,653
    You should avoid using

    "parentElement"

    as its only IE specific.

    replace it with

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

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles