Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Mar 2005
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Mozilla - minor problem

    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

  • #2
    Regular Coder COBOLdinosaur's Avatar
    Join Date
    Jul 2002
    Location
    Canada
    Posts
    404
    Thanks
    2
    Thanked 32 Times in 32 Posts
    Try:
    setTimeout("doc.getElementsByTagName('test').length",2000);
    100% standards compliant code is 100% correct 100% of the time.
    one of my toys from my repository and perhaps some help getting help

    Cd&


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •