...

View Full Version : Use XML Variable in Javascript



ptmuldoon
07-14-2009, 08:29 PM
I wasn't sure to post here or in the xml forum, so here goes..... :)

I have some xml data like below


<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.



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

Mike_O
07-14-2009, 09:45 PM
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



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum