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

  • Home
  • SEARCH
  • 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 6726949
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T09:59:23+00:00 2026-05-26T09:59:23+00:00

I am developing a web based seating plan for my office. Below is some

  • 0

I am developing a web based seating plan for my office. Below is some simple XML I have done up so I can test if my idea is working – on mouse over the desk image will turn green if desk free and red if desk taken (the image i used was sliced with Fireworks and now the rest of my dev is being done in Visual Studio 2010.

<?xml version="1.0" encoding="utf-8" ?>
<company>
  <employee id="1" email="Test1@hotmail.com" phone="1234">Test 1</employee>
  <employee id="2" email="Test2@hotmail.com" phone="6789">Test 2</employee>
  <employee id="" email="" phone="">Free Desk</employee>
</company>

So the below is what I was trying in my Javascript (Note there is more code below/above for reading in the xml, etc. The two alerts were tests I was trying – if commented in I can see that the value 1 and 2 is appearing on the webpage so I think it is reading the XML fine.

    //alert(xmlObj.childNodes(0).getAttribute("id"))
    //alert(xmlObj.childNodes(1).getAttribute("id"))


    for (var i = 0; i < 4; i++) 
    {

        **if (xmlObj.childNodes(i).getAttribute("id") == 1)** 
        {

            stringData = stringData.replace("s1.gif", "s3.gif");

        }
        else 
        {

            stringData = stringData.replace("s1.gif", "s2.gif");
        }
    }

However when I run I get the follwoing error on the line in Bold. Microsoft JScript runtime error: ‘xmlObj.childNodes(…)’ is null or not an object. Now I’m thinking it does not like the use of i – I was hoping that for the value 1 (i.e – desk 1 it would turn red (s1.gif being replaced with s3.gif) and for other numbers desk 0 and desk 2 it would turn red. Has anyone any ideas of what I am doing wrong?

  • 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-05-26T09:59:24+00:00Added an answer on May 26, 2026 at 9:59 am

    You’ve only specified 3 children for your company object. Your for loop executes 4 times, thus overrunning the bounds of the childNodes object within company.

    Change your for loop to for (var i = 0; i < xmlObj.childNodes.length; i++) and you won’t have any exceptions thrown.

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

Sidebar

Related Questions

I am developing a small intranet based web application. I have YSlow installed and
I don't have a lot of experience developing web-based data entry software, but comparative
I am developing a web-based user interface that plots some data from a database
I am developing a web based application where I need to have a detachable
I'm about to start developing a web-based application that I can best describe as
I'm developing a web based application built on codeigniter which will also have a
I am developing a web based application where users can send information trough messages.
I have a web-based documentation searching/viewing system that I'm developing for a client. Part
For developing a web based scan solution, I would love to test it on
We are developing a web based application on glassfish V3. We have 2 application

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.