如题:

解决方案 »

  1.   

    参考http://topic.csdn.net/u/20090912/12/af0562a2-6869-48b8-a1a4-bc165c02fa4d.html
    中我的回复
    把xmlReportData.async = "false"; 改成xmlReportData.async = "true";就是异步
      

  2.   

    或者http://topic.csdn.net/u/20090911/13/afedae08-8277-47d0-b481-2d1b27d49d63.html
    中我的回复..
      

  3.   

    Index.html文件:
    <script language="javascript">
    var xmlDoc;
    function initialize()
    {
      if(window.ActiveXObject)
        {
          xmlDoc=new ActiveXObject("Microsoft.XMLDOM");
          xmlDoc.onreadystatechange=function()
          {
            if(xmlDoc.readyState==4)
            {
              handleXmlDoc();
            }
          }
          xmlDoc.load("data.xml");
        }
      else if(document.implementation&&document.implementation.createDocument)
      {
        xmlDoc=document.implementation.createDocument('','',null);
        xmlDoc.onload=handleXmlDoc;
        xmlDoc.load("data.xml");
      }
    }
    function handleXmlDoc()
    {
      var root=xmlDoc.documentElement;
      var info=root.getElementsByTagName("info")[0];
      alert(info.getAttribute("type"));
      for(var i=0; i<info.childNodes.length; i++)
      {
        alert(info.childNodes[i].firstChild.nodeValue);
      }
    }
    window.onload=initialize;
    </script>xml文件:
    <?xml version="1.0" encoding="GB2312"?>
    <root>
        <info type="student">
          <name>Hello</name>
          <sex>Female</sex>
        </info>
    </root>
      

  4.   

    http://sheneyan.com/tech/article/ajax/4.html
      

  5.   

    谢谢,不过还有些地方看不懂能不能给下注释。我要在HTML中用JavaScript代码异步获取,XML文件中一个节点的值比如<?xml version="1.0" encoding="GB2312"?>
    <configuration>
       <appSettings>
    <add key="123" value="456"/>
       </appSettings>
    </configuration>我要在页面中异步获取<add>节点中key属性和value属性的值!也就是得到123和456