//返回结果代码 <result msg="">0000</result>
function getResultCode(retXML){
/*var resultXML = new ActiveXObject("Microsoft.XMLDOM");
resultXML.async = false;
resultXML.loadXML(retXML);
if (resultXML.selectSingleNode("//result")!=null){
return resultXML.selectSingleNode("//result").nodeTypedValue;
}else{
return "";
}*/
try{
var resultXML;
if (window.ActiveXObject){
resultXML = new ActiveXObject("Microsoft.XMLDOM");
resultXML.async = false;
resultXML.loadXML(retXML);
if (resultXML.selectSingleNode("//result")!=null){
return resultXML.selectSingleNode("//result").nodeTypedValue;
}else{
return "";
}
}else if(document.implementation && document.implementation.createDocument){
try{
resultXML = document.implementation.createDocument(‘‘, ‘‘, null);
resultXML.async = false;
var oParser=new DOMParser();
resultXML=oParser.parseFromString(retXML,"text/xml");
if (resultXML.childNodes[0].childNodes[0].data == "0000"){
return "0000";
}else{
return "";
}
} catch(e){
var xmlhttp = new window.XMLHttpRequest();
xmlhttp.open("GET",retXML,false);
xmlhttp.send(null);
resultXML = xmlhttp.responseXML;
}
}
}catch(e){
alert(e.message);
}
}
火狐 IE 解析xmlDOM 的不同写法