//创建一个XMLHttpRequest对象 ,利用此对象与服务器进行通信 是AJAX技术的核心
   
/**
 * 获取XmlHttpRequest对象
 */
function getXMLHttpRequest() {
    var xmlHttpReq=null;
    if (window.XMLHttpRequest) {//Mozilla 浏览器
        xmlHttpReq = new XMLHttpRequest();
    }else {
        if (window.ActiveXObject) {//IE 浏览器
            try {
                xmlHttpReq = new ActiveXObject("Microsoft.XMLHTTP");
            }
            catch (e) {
                try {//IE 浏览器
                    xmlHttpReq = new ActiveXObject("Msxml2.XMLHTTP");
                }
                catch (e) {
                }
            }
        }
    }
    return xmlHttpReq;
}

 

相关文章:

  • 2021-11-14
  • 2021-08-01
  • 2021-05-25
  • 2021-11-02
  • 2021-07-08
  • 2021-10-17
  • 2022-02-15
  • 2021-05-28
猜你喜欢
  • 2021-11-24
  • 2021-09-13
  • 2021-12-25
  • 2021-12-07
  • 2022-12-23
  • 2021-11-28
相关资源
相似解决方案