<script>
var xmlDoc= new ActiveXObject('Microsoft.XMLDOM');
xmlDoc.async=false;
xmlDoc.loadXML(src);//src为xml文件的路径
alert(xmlDoc.xml);
</script>

解决方案 »

  1.   

    不好意思,搞错了
    xmlDoc.loadXML(src);//src为xml文件的路径
    =====>
    xmlDoc.load(src);//src为xml文件的路径
      

  2.   

    HTML文件代码:
    <html>
    <head>
    <title>Ajax Hello World</title>
    <script type="text/javascript">
    var xmlHttp;function createXMLHttpRequest(){
    if(window.ActiveXObject){
    xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
    }
    else if(window.XMLHttpRequest){
    xmlHttp = new XMLHttpRequest();
    }
    }function startRequest(){
    createXMLHttpRequest();
    try{
    xmlHttp.onreadystatechange = handleStateChange;
    xmlHttp.open("GET", "data.xml", true);
    xmlHttp.send(null);
    }catch(exception){
    alert("eeee!");
    }
    }function handleStateChange(){
    if(xmlHttp.readyState == 4){
    if (xmlHttp.status == 200 || xmlHttp.status == 0){ var xmlDOM = xmlHttp.responseXML; var root = xmlDOM.documentElement;
    try
    { var info = root.getElementsByTagName('info'); alert("responseXML's value: " + info[0].firstChild.data);
    }catch(exception)
    {
    alert("The source is not exist!");
    }
    }
    }
    }
    </script>
    </head>
    <body>
    <div>
    <input type="button" value="return ajax responseXML's value"
    onclick="startRequest();" />
    </div>
    </body>
    </html>xml文件:
    <?xml version="1.0" encoding="GB2312" ?> 
    <root>
    <info>hello world!</info>
    </root>
      

  3.   

    nodeValue
    nodeName
    xml dom的标准属性都可以访问
      

  4.   

    楼上的这些方法只有在IE6以下版本的浏览器中才可能。IE7和火狐是不强安全机制,不支持浏览本地盘符。