if(window.ActiveXObject){
        oHttpReq = new ActiveXObject("Microsoft.XMLHTTP");
        oDoc = new ActiveXObject("MSXML2.DOMDocument");    //响应结果        oHttpReq.open("post","function/Default.aspx?id="+state, false);
        oHttpReq.send("");
        result = oHttpReq.responseText;
        oDoc.loadXML(result);        
        
    }else if(window.XMLHttpRequest){    
        oHttpReq = new XMLHttpRequest();      
        oHttpReq.open("post","function/Default.aspx?id="+state, false);      
        oHttpReq.send(null);        
        result = oHttpReq.responseText;
        //var str = '<?xml version="1.0" encoding="utf-8" ?>';
       // result = str+result;
        alert(result);
        oDoc = document.implementation.createDocument("","",null); 
        oDoc.async   =   false;  
        oDoc.load(result);        
    }    
        items = oDoc.selectNodes("//address");        for (var item = items.nextNode();item;item = items.nextNode())
        { 
            var SectionName = item.childNodes[1].nodeTypedValue;            var newOption = document.createElement("OPTION"); 
            newOption.text = SectionName; 
            newOption.value = drp2.options.length; 
            drp2.options.add(newOption); 
        }  IE中可行,FF中 items开始就得不到数据了。望高手帮忙看下。

解决方案 »

  1.   

    function createXMLHttpRequest() 
            { 
                if(xmlHttp == null){
                    if(window.XMLHttpRequest) {
                        //Mozilla 浏览器
                        xmlHttp = new XMLHttpRequest();
    //                    if (xmlHttp.overrideMimeType) {
    //                        //设置MiME类别
    //                        xmlHttp.overrideMimeType("text/xml");
    //                    }
                    }else if(window.ActiveXObject) {
                        // IE浏览器
                        try {
                            xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
                        } catch (e) {
                            try {
                                xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
                            } catch (e) {
                            }
                        }
                    }
                }
            } 
      

  2.   

    把 
    oHttpReq = new ActiveXObject("Microsoft.XMLHTTP"); 
    这个换了
      

  3.   

    http://blog.csdn.net/Sandy945/archive/2009/06/29/4307710.aspx
      

  4.   

    直接用jquerey的Ajax方法不是很好!
      

  5.   

    var xmlHttp = null;
    function getXmlHttp(){
        if(window.XMLHttpRequest){
            xmlHttp = new XMLHttpRequest();
        }else if(window.ActiveXObject){
            var arrXmlHttpTypes = ['MSXML2.XMLHTTP.6.0','MSXML2.XMLHTTP.3.0','Microsoft.XMLHTTP'];
            for(var i=0;i<arrXmlHttpTypes.length;i++){
                try{
                    xmlHttp = new ActiveXObject(arrXmlHttpTypes[i]);
                }catch(ex){}
            }
        }
    }//mf 
    if (window.XMLHttpRequest) //mf 

    xmlhttp=new XMLHttpRequest() 
    xmlhttp. 
    xmlhttp.open("GET",url,true) 
    xmlhttp.send(null) 

    //ie 
    else if (window.ActiveXObject) // code for IE 

    xmlhttp=new ActiveXObject("Microsoft.XMLHTTP") 
        if (xmlhttp) 
        { 
        xmlhttp. 
        xmlhttp.open("GET",url,true) 
        xmlhttp.send() 
        } 


    firefox中使用responseXML返回的值,不支持selectNodes,selectSingleNode方法,只能使用getElementsByTagName方法。