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
    Regular Coder
    Join Date
    Feb 2005
    Posts
    663
    Thanks
    5
    Thanked 14 Times in 14 Posts

    Use XML Variable in Javascript

    I wasn't sure to post here or in the xml forum, so here goes.....

    I have some xml data like below
    Code:
    <global>
        <var name="ROSTER_SIZE">14</var>
        <var name="UNIQUE_POSITIONS">6</var>
        <var name="PHASE">0</var>
        <var name="DEADLINE">1252249200000</var>
        <var name="NOW">1247595371000</var>
        <var name="LOCALNOW">1247580971000</var>
        <var name="ENCODED_ANNOUNCEMENT"></var>
        <var name="TIME_ZONE">EDT</var>
    ....
    ....
    ....
    And I'd like to be able use some of this data into the below script.

    Code:
    function initialize_flash_movie ()
    {
    	flashobj.addParam ("allowScriptAccess", "always");
    	flashobj.addVariable ("phase",       "0");
    	flashobj.addVariable ("server",      "1247583291000");
    	flashobj.addVariable ("localtime",   "1247580971000" );  <--- Change this to LOCALNOW
    	flashobj.addVariable ("timetarget",  "1252249200000");
    	flashobj.addVariable ("timezone",    "EDT");
    	flashobj.addVariable ("pick",        "");
    	flashobj.addVariable ("onclock",     "");
    	flashobj.addVariable ("LID",         "301");
    	flashobj.addVariable ("period",      "100");
    	flashobj.addVariable ("lengua",      "english");
    	flashobj.addVariable ("PAOnClock",   "000");
    	flashobj.addVariable ("PAOnDeck",    "000");
    	flashobj.addVariable ("announcement","");
    	flashobj.addVariable ("showAD",      "0")
    	flashobj.write("flashcontent");
    	myMovie =  (block == 'block') ? window['Mike'] : document['Mike'];
    }
    Does anyone have any suggestions? I'm pretty (or very) green with javascript.

    Thanks
    PT

  • #2
    Regular Coder
    Join Date
    Apr 2009
    Posts
    244
    Thanks
    1
    Thanked 20 Times in 20 Posts
    Hi ptmuldoon,

    Sounds like you need to use an XML parser. Whether the XML is a string or a separate file, I think the
    following link will give you the idea:

    http://www.w3schools.com/Xml/xml_dom.asp

    Regards,
    Mike


  •  

    Posting Permissions

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