QUERY: childNodes[0] not working in FF :(

I have a table row structured like this (mind the XSL variable):










and I have been using JavaScript like:


var tr = document.getElementById(this.Table).rows.item(i + 1);

if(tr.childNodes[0].childNodes[0].value == 1 || tr.childNodes[0].childNodes[0].value == 2)
{
}


This works perfectly fine in Internet Explorer. But in Mozilla Firefox I get:


tr.childNodes[0].childNodes[0] has no properties


Somehow childNodes, obj.parentElement, etc are not working anymore in Mozilla Firefox. Is
the DOM tree syntax totally different between IE and FF?

Please can someone help.

Comments

  • : I have a table row structured like this (mind the XSL variable):
    :
    :
    :
    :
    :
    :
    :
    :
    :
    :
    : and I have been using JavaScript like:
    :
    :
    : var tr = document.getElementById(this.Table).rows.item(i + 1);
    :
    : if(tr.childNodes[0].childNodes[0].value == 1 || tr.childNodes[0].childNodes[0].value == 2)
    : {
    : }
    :
    :
    : This works perfectly fine in Internet Explorer. But in Mozilla Firefox I get:
    :
    :
    : tr.childNodes[0].childNodes[0] has no properties
    :
    :
    : Somehow childNodes, obj.parentElement, etc are not working anymore in Mozilla Firefox. Is
    : the DOM tree syntax totally different between IE and FF?
    :
    : Please can someone help.
    :
    There are subtle differences between the various DOMs and the w3 specifications. The following site shows the "official" way to code it:
    http://www.w3schools.com/js/tryit.asp?filename=try_dom_tablerow_cells
    Accoring the the w3schools it works for both IE and FF and is according to the w3 specifications.
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

In this Discussion