www.webdeveloper.com
Results 1 to 3 of 3

Thread: [RESOLVED] Question with nodes

Hybrid View

  1. #1
    Join Date
    Jul 2013
    Posts
    3

    resolved [RESOLVED] Question with nodes

    Hello, I'm receiving this information from an ajax request. I've figured out the node map I guess. To test that I have the correct Item I list the nodeName and it is a TBODY which is what I'm looking for. This works the same on ie, ff, and chrome. However, when I try to alert the childNodes.length, I get a value of 9 on chrome(which is correct), and a value of 1 on ie and ff. I've tried to output the childNodes[0].nodeName and on all three browsers it displays #text. If I display the value, they all display empty text. If I attempt to alert the childNodes[1].nodeName, it shows TR(which is what i'm looking for) on chrome while on ie and ff the code doesn't do anything(I imagine because of undefined index on these browsers?). I've tried a similar example on my localhost with a simple table and it works fine across all browsers. Why would something like this not work on the actual site? Thanks in advance.

  2. #2
    Join Date
    Jul 2013
    Posts
    3
    I forgot to include the code I've been working on:
    Code:
                            var str = data;
                            var code = $(str);                                              
    
                            var tbody = code[100].childNodes[3].childNodes[7].childNodes[1].childNodes[5].childNodes[5].childNodes[1].childNodes[1].childNodes[1].childNodes[3].childNodes[5];
                            
                            alert(tbody.childNodes[1].nodeValue);
    //                        for(var i=0; i < tbody.childNodes.length; i++){
    //                            if(tbody.childNodes[i].nodeName == "TR"){
    //                                alert(tbody.childNodes[i].nodeName);
    //                            }
    //                        }
    //                        alert(tbody.childNodes.length);
    //                        document.write(data);
    the commented out part is working fine on chrome but not on the other browsers that's why I have it commented out right there

  3. #3
    Join Date
    Jul 2013
    Posts
    3
    The code is working fine I've been working on this for a while and forgot to consider sessions.

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