...

View Full Version : Need help with XMLHttpRequest



pneudralics
08-12-2011, 12:27 AM
I'm starting to learn javascript and trying to get the below code to work with newer browsers. I'm not sure how to implement the below to make it work with XMLHttpRequest. There is a small form that uses this function to allow you to select an xml file to load. Your help is much appreciated. Thanks.



function importXML() {


if (document.implementation && document.implementation.createDocument) {
xmlDoc = document.implementation.createDocument("", "", null);
xmlDoc.onload = createQuiz;
}
else if (window.ActiveXObject) {
xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
xmlDoc.onreadystatechange = function () {
if (xmlDoc.readyState == 4) createQuiz()
};
}
else {
alert('Your browser cannot handle this script');
return;
}
xmlDoc.load(document.getElementById('file').value);
}

dcd4u2
08-12-2011, 08:59 AM
Look what I did for that in my post [URL="http://www.codingforums.com/showthread.php?t=234822"]post



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum