children.tags - also for Mozilla?

Discuss building things with or for the Mozilla Platform.
Post Reply
madman2k
Posts: 6
Joined: July 29th, 2003, 11:04 am

children.tags - also for Mozilla?

Post by madman2k »

hello, does anybody know how i can make the following JS code Mozilla-compatible?

Code: Select all

this.children.tags('TD')[1].children.tags('A')[0].click();


this code has to click on a link, which is 2Levels below the clicked TR-Tag in the following table

Code: Select all

<table>
 <tr onclick="this.children.tags('TD')[1].children.tags('A')[0].click();">
  <td></td>
  <td><a href="..."></a></td>
 </tr>
</table>


the problem is, that Mozilla doesnt understand the "children.tags" Element
Sander
Posts: 634
Joined: November 5th, 2002, 5:35 am
Location: The Netherlands, when not travelling

Post by Sander »

Take a look at getElementsByTagName, childNodes and similar, which are used in the standards-compliant way to do this (and will probably _also_ work in IE).
doron
Posts: 935
Joined: November 4th, 2002, 4:50 pm

Post by doron »

should work in IE and Gecko:

this.getElementsByTagName('TD')[1].getElementsByTagName("A")[0].click();
If you see a marquee, clap your hands!
madman2k
Posts: 6
Joined: July 29th, 2003, 11:04 am

Post by madman2k »

thanks, the script works fine for IE, but I found out, that Mozilla doesnt support click() for non <input> object, so the whole thing became senseless...
Post Reply