建立XMLHttpRequest對象方法

~~~瀏覽器

//建立XMLHttpRequest對象
    function creatXmlHttpRequest() {
        var xmlHttp;
        try{
            //非IE瀏覽器使用
            xmlHttp = new XMLHttpRequest();
        }catch(e){
            try{
                xmlHttp = new ActiveXobject("Msxm.XMLHTTP");
            }catch(e){
                try{
                    xmlHttp = new ActiveXobject("Microsoft.XMLHTTP");
                }catch(e){

                }
            }
        }
        return xmlHttp;
    }

    ~~~
相關文章
相關標籤/搜索