The following code only works when loading xml in ff, IE6+, and Opera.
XML cannot be loaded in Chrome. If you have a good method, I hope you can share it here. Thank you.
A lot of online searches don't support load("pc175.xml") to load XML.
I found a solution in google. Is it useful? Is it useful for everyone to discuss?
http://code.google.com/p/chromium/issues/detail?id=988#c21
The following code supports ff, IE6+, Opera
function getXmlDocument(file){
var xmlDoc;
try{ //Internet Explorer
xmlDoc=new ActiveXObject("Microsoft.XMLDOM");
}
catch(e){
try{ /*Firefox, Mozilla, Opera, etc.*/
xmlDoc=document.implementation.createDocument("","",null);
}
catch(e){
alert(e.message);
return;
}
}
xmlDoc.async=false;
xmlDoc.load(url);
return xmlDoc;
}