获取XHR对象
[html]function createXHR(){if( typeof XMLHttpRequest != "undefined" ){return new XMLHttpRequest();}else if( typeof ActiveXObject != "undefined"){ // 判断ievar versions = ["MSXML2.XMLHttp.6.0","MSXML2.XMLHttp.3.0","MXXML2.XMLHttp"];for( var i = 0;i < versions.length; i++ ){try{return new ActiveXOject( versions[ i ] );}catch(e){//跳过}}}else{throw new Error( "您的浏览器不支持XHR对象!" )}}var xhr = new createXHR();alert(xhr)
补充:Web开发 , 其他 ,