jquery 解析xml字符串
程序员文章站
2022-03-01 23:14:51
...
var xmlstr="<xml><log>log1</log><log>log2</log><status>status_2</status></xml>";
var xmldom=null
if(navigator.userAgent.toLowerCase().indexOf("msie")!=-1){
xmldom=new ActiveXObject("Microsoft.XMLDOM");
xmldom.loadXML(xmlstr);
}
else
xmldom=new DOMParser().parseFromString(xmlstr,"text/xml");
$(xmldom).find("log").each(function(){
alert($(this).text())
})
var xmldom=null
if(navigator.userAgent.toLowerCase().indexOf("msie")!=-1){
xmldom=new ActiveXObject("Microsoft.XMLDOM");
xmldom.loadXML(xmlstr);
}
else
xmldom=new DOMParser().parseFromString(xmlstr,"text/xml");
$(xmldom).find("log").each(function(){
alert($(this).text())
})
上一篇: 分页查询存储过程