var xmlDoc =  new ActiveXObject("Msxml2.DOMDocument");IE 支持   firefox 不支持 ,为什么啊  ? 有什么解决的办法没?

解决方案 »

  1.   

    支持ie,ff,chrome,opera,safari:/*
     *读取xml
     */
     var readXML=function(xmlFile) {
        var xmlDoc;
        if(window.ActiveXObject){
            xmlDoc = new ActiveXObject('Microsoft.XMLDOM');
            xmlDoc.async = false;
            xmlDoc.load(xmlFile);
            //return xmlDoc.documentElement.xml;
        } else if (document.implementation&&document.implementation.createDocument){
            var xmlhttp = new XMLHttpRequest();
            xmlhttp.open("GET",xmlFile,false);
            xmlhttp.send(null);
            xmlDoc = xmlhttp.responseXML;
            //return new XMLSerializer().serializeToString(xmlDoc);
        } else {
            return null;
        }
        return xmlDoc;
    }
      

  2.   

     ActiveXObject本来就是IE的专利啊!!!