Results 1 to 2 of 2

Thread: tag issue..Could be a javascript issue no sure..

  1. #1
    Join Date
    Aug 2010

    tag issue..Could be a javascript issue no sure..

    Hi, I am reading an xml file and it has several of the same tags.. So I am adding each of the strings to an array.. the problem occurs when I only have one tag Each character is placed into the array individually.. Example below..
    Example 1;

    Example 2;

    for (i = 0; i < student.name.length; i++) {


    Example 1 Output: StudentArray[0]="Josh" [1]="Joseph"...and so on
    Example 2 Output: StudentArray[0]="j" [1]="o"[2]="s"...

    see.. When you only have one tag it counts the string length.. I want to avoid that and only count the tags.. Please No "parent-node"I would just like to work with the object itself as shown. thank you!

  2. #2
    Join Date
    Nov 2002
    Baltimore, Maryland
    names = student.getElementsByTagName ('name')
    “The power of the Web is in its universality. Access by everyone regardless of disability is an essential aspect.”
    —Tim Berners-Lee, W3C Director and inventor of the World Wide Web

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