• Home
  • New Entries
  • Popular Entries
  • Submit a Story
  • About

Trying to loop an xml page from ajax ...

Got this code, which works fine in FF3 - it dynamically redraws a menu
from user input.
####
function so_clearInnerHTML(obj) {
// so long as obj has children, remove them
while(obj.firstChild) obj.removeChild(obj.firstChild);
} - this just for info - ignore that there is no function around the next
bit!

if (httpRequest.status == 200) {
var xmldoc = httpRequest.responseXML;
//var objNodeList;
//objNodeList = xmldoc.getElementsByTagName
( isystemname);
so_clearInnerHTML(document.getElementById
("systemslist"));

// loop through the returned xml list for entries and
append them back to the div
var x = 0;
while (xmldoc.getElementsByTagName( isystemname)[x]) {
//alert(counted[+i+]);
var sysname = xmldoc.getElementsByTagName
( isystemname)[x].childNodes[0].nodeValue;
var sysid = xmldoc.getElementsByTagName( isystemid)
[x].childNodes[0].nodeValue;
//alert( isystemname[+sysname+]);
//alert( isystemid[+sysid+]);
// create a DIV element, using the variable eLink as
a reference to it
eLink = document.createElement("a");
//use the setAttribute method to assign it an id
eLink.setAttribute("href","findsystem.asp?
systemid="+sysid);
// add the text from isystemname to the anchor
element
eLink.appendChild(document.createTextNode
(xmldoc.getElementsByTagName( isystemname)[x].childNodes[0].nodeValue));
// append your newly created element to an already
existing element.
document.getElementById("systemslist").appendChild
(eLink);
eBreak = document.createElement("br");
document.getElementById("systemslist").appendChild
(eBreak);
x++;
}

} else {
alert(There was a problem with the request.);
}
####

doesn repopulate the menu via IE6 or 7
I tried to switch the while to a for -
##
for (var i=0; i<objNodeList.length; i++) {
##
(ignore the x switch in i)

but that returns a zero length list of nodes for IE, and still works for
FF

is there another way for IE to see the existance of the node list, or do
I need to approach the looping some other way?

source: newsgroups.derkeiler

 View Full Story.
Posted at 09:26:21 am | Permalink | Posted in XmlHttpRequest  

Related Stuff

  • MooV: Using cutting edge Video phones and Software Video Phones - coupling all that with VoIP and empowering the disabled.

  • Moo Telecom: VoIP communications made easy - Ring anyway with the fun and ease of using a normal phone

  • TagR:Mobile Social Network with Real Time Locations Based services, and Ambience Intelligence, VoiP, IM, Skype, Googletalk, Mapping, Flickr, Events, Calendaring, Scheduling, SecondLife Support

  • ClearSMS : ClearSMS is a Web-based application that lets you send bulk SMS messages to your customers, contacts, or just about anyone.

  • Jajah:jah is a VoIP (Voice over IP) provider, founded by Austrians Roman Scharf and Daniel Mattes in 2005[1]. The Jajah headquarters are located in Mountain View, CA, USA, and Luxembourg. Jajah maintains a development centre in Israel.

  • Skype: It’s free to download and free to call other people on Skype. Skype the number one voice over ip software

  • PrivatePhone: a free local phone number with voicemail and messages you can check online or from any phone.

Be the first ... |Add your comment.

Your Comment ...

  Name (required)

  Email (required, hidden)

  Website


About Ajaxlines

Ajaxlines is a project focused on providing its audience with a database of most of Ajax related articles, resources, tutorials and services from around the world.

Its purpose is to showcase the power of Ajax and to act as a portal to the Ajax development community.


Recent Stuff

Making AJAX Ro(a)R

Ruby on Rails Applications Development with Ajax

Facebook Drops Another Hurdle

FBJS and Ajax to acheive Facebook profile link tracking

Getting a JavaScript stracktrace in any browser

Ajax data picker Javascript


Our Partners

Facebook Applications

Ajax Projects

Web 2.0 Sites

Webloglines

Human Development Handbook

Software Development Company

Ajaxlines

Stock Exchange Chat


Search


Topics

  • .Net (109)
  • Articles (82)
  • Bookmarking (35)
  • Calendar (19)
  • Chat (39)
  • ColdFusion (3)
  • CSS (37)
  • Email (23)
  • Facebook (19)
  • Flash (15)
  • Games (6)
  • Google (26)
  • Html (13)
  • Image (11)
  • International Calls & VOIP (7)
  • Java (36)
  • Javascript (169)
  • JSON (21)
  • Perl (2)
  • PHP (87)
  • Presentation (19)
  • Python (3)
  • Resources (2)
  • RSS (1)
  • Ruby (9)
  • Storage (4)
  • Toolkits (90)
  • Tutorials (196)
  • UI (11)
  • Utilities (166)
  • Web2.0 (13)
  • XmlHttpRequest (20)
  • YUI (4)

© 2006 www.ajaxlines.com. All Rights Reserved. Powered by IRange