找回密码
 注册

QQ登录

只需一步,快速开始

查看: 198|回复: 0

jquery 解析xml

[复制链接]
发表于 2013-6-5 12:30:38 | 显示全部楼层 |阅读模式
jquery 解析xml字符串

  1.    var xmlstr="<xml><log>log1</log><log>log2</log><status>status_2</status></xml>";
  2.     var xmldom=null
  3.     if(navigator.userAgent.toLowerCase().indexOf("msie")!=-1){
  4.         xmldom=new ActiveXObject("Microsoft.XMLDOM");
  5.         xmldom.loadXML(xmlstr);
  6.     }
  7.     else
  8.         xmldom=new DOMParser().parseFromString(xmlstr,"text/xml");
  9.     $(xmldom).find("log").each(function(){
  10.     alert($(this).text())
  11.     })
复制代码


您需要登录后才可以回帖 登录 | 注册

本版积分规则

手机版|小黑屋|BC Morning Website ( Best Deal Inc. 001 )

GMT-8, 2026-6-11 03:02 , Processed in 0.015613 second(s), 16 queries .

Supported by Weloment Group X3.5

© 2008-2026 Best Deal Online

快速回复 返回顶部 返回列表