Howdy, Stranger!

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

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

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

dhruba.bandopadhruba.bandopa Posts: 28Member
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

  • zibadianzibadian Posts: 6,349Member
    : 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.