关于xmlHttpRequest如何兼容各个浏览器的问题

         var xmlHttp;
         function createXMLHttpRequest(){
               if(window.ActiveXObject){
               xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
              
               }else{
               xmlHttp=new XMLHttpRequest();
               }
        
         }

        如果浏览器支持ActiveX对象,则用ActiveXObject创建XMLHttpRequest对象没如果不支持,则用javascript对象XMLHttpRequest创建。
        之前面试问过。

        

你可能感兴趣的:(XMLhttpREquest,xmlhttp)