cherryQQ 发表于 2013-1-23 02:55:26

Ajax 无法在IE7.0中运行 已解决

function createRequest()
{//alert("start createRequest");
    try{
       request=new ActiveXObject("Msxml2.XMLHTTP");    }catch(trymicrosoft)
    {
      try{
    request=new XMLHttpRequest();       }catch(othermicrosoft)
      {
            try{
            if(window.ActiveXObject){
    request = new ActiveXObject("Microsoft.XMLHTTP");
}else if(window.ActiveXObject){
    request = new ActiveXObject("Msxml2.XMLHTTP.4.0");
}else if(window.XMLHttpRequest){
   request = new XMLHttpRequest();
}
            }
            catch(failed)
            {
                request=false;
            }
      }
    }
    if(!request)
    {
      alert("err Happend!");
       return null;
    }      
    return request;
}

解决一些朋友:在IE7中无法显示的痛苦
注意位置:红色所在的位置
页: [1]
查看完整版本: Ajax 无法在IE7.0中运行 已解决