xmldoc.onreadystatechange = CheckState;
 ">

Ms XmlDom 异步装载Xml文件

80酷酷网    80kuku.com

  dom|xml|异步<script>
var xmldoc;
function Load(){
  xmldoc = new ActiveXObject("Msxml2.DOMDocument");
  xmldoc.onreadystatechange = CheckState;
  xmldoc.resolveExternals = false;
  xmldoc.load(URL.value);
}
function CheckState(){
  var state = xmldoc.readyState;
  RESULTS.innerHTML += "加载状态 = " + state + "
"
  if (state == 4){
    var err = xmldoc.parseError;
    if (err.errorCode != 0)
      RESULTS.innerHTML += err.reason +  "
"
    else
    {
     RESULTS.innerHTML += "加载成功。" +  "
"
     alert(xmldoc.xml)
     }
  }
}
</script>
URL: <input type=text size=60 id=URL value="http://dotnet.aspx.cc/Rss.aspx">
<input type=button value="正在XML" >
<div id=RESULTS font-weight:bold;"></div>

分享到
  • 微信分享
  • 新浪微博
  • QQ好友
  • QQ空间
点击: