标签:xmldom
//返回结果代码 <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);
}
}
本文出自 “WOCHA” 博客,请务必保留此出处http://yangzuojie.blog.51cto.com/3627408/1538572
火狐 IE 解析xmlDOM 的不同写法,布布扣,bubuko.com
标签:xmldom
原文地址:http://yangzuojie.blog.51cto.com/3627408/1538572