谷歌js读取xml到xmlDoc.load(xmlFile)时就停止了var xmlDoc;  
if(window.ActiveXObject) {   
xmlDoc=new ActiveXObject("Microsoft.XMLDOM");   
xmlDoc.async=false;  
xmlDoc.load(xmlFile);  
}  
else if(document.implementation&&document.implementation.createDocument){  
xmlDoc=document.implementation.createDocument("", "",null);   
xmlDoc.async=false; alert("aaa"); 
xmlDoc.load(xmlFile);
/*var xmlhttp = new window.XMLHttpRequest();
xmlhttp.open("GET", xmlFile, false);
xmlhttp.send(null);
xmlDoc = xmlhttp.responseXML;*/
} else{  
alert('Your browser cannot handle this script');   
}  
return xmlDoc;  
谷歌是否有另外的api

解决方案 »

  1.   

    我也遇到这个问题了,提示 xmlhttp.send(null); 有问题,还没有找到解决办法,等高手。
      

  2.   

    xmlhttp.open("GET", xmlFile, false);
    这个URL用你网站的全路径试试
      

  3.   

    function loadXMLDoc(dname) 
    {
    try //Internet Explorer
      {
      xmlDoc=new ActiveXObject("Microsoft.XMLDOM");
      }
    catch(e)
      {
      try //Firefox, Mozilla, Opera, etc.
        {
        xmlDoc=document.implementation.createDocument("","",null);
        }
      catch(e) {alert(e.message)}
      }
    try 
      {
      xmlDoc.async=false;
      xmlDoc.load(dname);
      return(xmlDoc);
      }
    catch(e) {alert(e.message)}
    return(null);
    }function init() { 
     xmlDoc=loadXMLDoc("test.xml");}
      

  4.   

    我试了一下,也遇到同样的问题了.ff 和 ie 都能过.chrome中的错误提示是:
    Uncaught TypeError: Object #<Document> has no method 'load'有人知道为什么吗?
      

  5.   

    Google Chrome (traces to WebKit and Chromium) does not implement XMLdocument.load method.
    So you have to use XmlHttpRequests, which Chrome does support.
    Off-Topic:  I'm assuming this is a problem for Safari too.
    上面是在google论坛上找到的.看来在google浏览器中只能够用xmlhttprequest 拿xml了