CSDN博客

img luoboqingcai

Ms XmlDom 异步装载Xml文件

发表于2004/9/27 17:19:00  797人阅读

分类: 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 + "<BR>"
  if (state == 4){
    var err = xmldoc.parseError;
    if (err.errorCode != 0)
      RESULTS.innerHTML += err.reason +  "<BR>"
    else
    {
     RESULTS.innerHTML += "加载成功。" +  "<BR>"
     alert(xmldoc.xml)
     }
  }
}
</script>
URL: <input type=text size=60 id=URL value="http://dotnet.aspx.cc/Rss.aspx">
<input type=button value="正在XML" onclick="Load()">
<div id=RESULTS style="color:red; font-weight:bold;"></div></script>

阅读全文
0 0

相关文章推荐

img
取 消
img