快速创建你xmlhttp的方法

Posted xieyongbin

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了快速创建你xmlhttp的方法相关的知识,希望对你有一定的参考价值。

function initxmlhttp() 

    var xmlhttp 
    try { 
        xmlhttp=new ActiveXObject("Msxml2.XMLHTTP"); 
    } catch (e) { 
        try { 
            xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); 
        } catch (E) { 
            xmlhttp=false; 
        } 
    } 
    if (!xmlhttp && typeof XMLHttpRequest!=‘undefined‘) { 
        try { 
            xmlhttp = new XMLHttpRequest(); 
        } catch (e) { 
            xmlhttp=false; 
        } 
    } 
    if (!xmlhttp && window.createRequest) { 
        try { 
            xmlhttp = window.createRequest(); 
        } catch (e) { 
            xmlhttp=false; 
        } 
    } 
    return xmlhttp; 
}




























以上是关于快速创建你xmlhttp的方法的主要内容,如果未能解决你的问题,请参考以下文章