Javascript Function Working onclick() but Not onload() In IE

DimaMichurin

New Member
I'm having a strange issue in IE where a function I call in body \[code\]onload\[/code\] sometimes silently fails and sometimes works in Internet Explorer.The function loads an external XML file and then parses through it. It seems like sometimes it tries to parse through the XML file before it has finished loading, causing it to fail.As a fail-safe, users can click on a play button which will call the same function again, and this tends to work (although obviously it's not an ideal solution). See the code in action here: http://www.nba.com/warriors/audiotrack_test01.html?david-lee-on-95-7-the-game-5-7Here is the function called \[code\]onload\[/code\] and \[code\]onclick\[/code\]:\[code\]function loadDocCORS(){ var urlPermalink = delineate(); // get track ID from url following ? if (urlPermalink != -1) getCORS('http://api.soundcloud.com/users/goldenstatewarriors/tracks?client_id=02db8e29aa2fb5bf590f478b73137c67&format=xml', null, function(data){xmlDoc=data; loadTrack(urlPermalink);});}\[/code\]Is there a way to have it wait until it is sure the XML document is loaded before proceeding to assign xmlDoc=data?Note I have never experienced this problem in Firefox or Chrome.
 
Back
Top