AJax兼容ie6
发布时间:2020-12-16 01:40:41 所属栏目:百科 来源:网络整理
导读:Ajax对象XMLHttpRequest(w3c+ie7以上),和ie对象ActiveXObject。 想要兼容ie6,用到以下代码(如果ie6已经彻底淘汰了,各位就不用看了)。 function createXML () { if ( typeof XMLHttpRequest!= 'undefind' ){ return new XMLHttpRequest(); } else if ( t
Ajax对象XMLHttpRequest(w3c+ie7以上),和ie对象ActiveXObject。 function createXML(){
if(typeof XMLHttpRequest!='undefind'){
return new XMLHttpRequest();
}else if(typeof ActiveXObject!='undefind'){
try{
return new ActiveXObject("Msxml2.XMLHTTP");
}catch(e){
try{
return new ActiveXObject("Microsoft.XMLHTTP");
}catch(e){
}
}
}
}
Msxml2.XMLHTTP和Microsoft.XMLHTTP是版本信息(Msxml.XMLHTTP,Msxml.XMLHTTP3.0和Msxml.XMLHTTP4.0) (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |