Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8590065
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T23:12:29+00:00 2026-06-11T23:12:29+00:00

So I finished a project using DOM to get data. Everything worked great, and

  • 0

So I finished a project using DOM to get data. Everything worked great, and my code passed code review. However, one day after I implemented a new feature my code broke. I took the broken code which I havn’t touched and replicated it at W3C schools testing location that can be found here.

http://www.w3schools.com/dom/tryit.asp?filename=try_dom_nodelist_item

Simply Copy My Code into there and run it. You get the output as “2”, when you’d expect to see “5”, since there is obviously five rows in the table. I hope some guru can answer this question. Thanks in advance.

Some more potentially helpful information: I ran this in Visual Studios as well and debugged it to see what was going on. Apparently, no matter how many rows you put it, it’s always going to spit out 2, and on top of that the two objects it spits out is both null. How weird is this??

<!DOCTYPE html>
<html>
<head>
</script>
</head>
<body>
            <h2><i>Albums</i></h2> 
            <table cellspacing="0" border="4" id = "table" class = "lazyProgressiveLoad">
                <tr style="font-style: italic; font-size: small; font-family: Segoe UI Light; color: Navy">
                    <th>--Id--</th>
                    <th>--Name--</th>
                    <th>--Description--</th>
                    <th><input type="button" value="Add Album" onclick="alert('Guru's Please Help!!!')" id = "addAlbum"/></th>
                </tr>
                <tr>
                    <td>Load, Search, or Add Albums to Get Started!</td>
                    <td>~~~</td>
                    <td>~~~</td>
                    <td>~~~</td>
                </tr>
                <tr>
                    <td>Load, Search, or Add Albums to Get Started!</td>
                    <td>~~~</td>
                    <td>~~~</td>
                    <td>~~~</td>
                </tr>
                <tr>
                    <td>Load, Search, or Add Albums to Get Started!</td>
                    <td>~~~</td>
                    <td>~~~</td>
                    <td>~~~</td>
                </tr>
                <tr>
                    <td>Load, Search, or Add Albums to Get Started!</td>
                    <td>~~~</td>
                    <td>~~~</td>
                    <td>~~~</td>
                </tr>
                <tr>
                </tr>
            </table>
<script>
window.onload = function () {
alert(parseInt(document.getElementById("table").childNodes.length));
}

</script>
</body>
</html>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T23:12:30+00:00Added an answer on June 11, 2026 at 11:12 pm

    I know now why there was this bug in my program. I had originally .children used to traverse through my DOM tree, and at some point or another when I was implementing Lazy Load into my program, .children magically changed into .childNodes… which broke my code, because .children is totally different from .childNodes….

    So this is what to take away from this:

    1) .rows -> Gives you all the rows of a table only

    2) .childNodes -> Gives you the immediate child Nodes even the automatically inserted ones for you

    3) .children -> Acts similar to rows’s functionality except it works for everything else as well

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've just finished setting up a project using MVC 3, Fluent nHibernate, AutoMapper, and
I started using backbone for my projects. I finished a simple project and it
So I just finished working the project at http://msdn.microsoft.com/en-us/data/gg685489 . I am trying to
I just finished the Django tutorial and started work on my own project, however,
I'm almost finished developing my large project, however I would love it if I
I was given a half-finished project to finish. It was written in C++ using
Just finished my project in Eclipse, using Sphinx for voice recognition. In eclipse the
I recently finished a project using TDD and I found the process to be
I'm working on integrating Ben Gottlieb's Twitter-OAuth-iPhone code into my cocos2d 0.99.5 project using
I have worked almost one day with Jenkins to setup for automation publishing an

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.