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);
}
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);
}