...

View Full Version : Mozilla - minor problem



p2005
03-19-2005, 04:18 PM
Hi,

I have written a js include that reads in an xml file and parses it. However I am having some minor problems!

I have loaded an XML file a method I have created, then once the document is loaded, I call a function that will parse the xml file:
xmlDoc.onload=parseXML(xmlDoc);

The first line of code in the XML parsing method is :

doc.getElementsByTagName('test').length;

However this line of code does not work unless I place an alert() popup just before this line ( the length is 0, if i put in the alert() the length is 10!!) It seems like a delay is required to give the xml document a chance to load, but I have tried putting in a while loop instead of an alert, but this does not work.

Thanks

COBOLdinosaur
03-19-2005, 09:56 PM
Try:
setTimeout("doc.getElementsByTagName('test').length",2000);



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum