functioncreateXHR(){if(typeofXMLHttpRequest!='undefined'){returnnewXMLHttpRequest();}elseif(typeofActiveXObject!='...
function createXHR() { if (typeof XMLHttpRequest != 'undefined') { return new XMLHttpRequest(); } else if (typeof ActiveXObject != 'undefined') { var version = [ 'MSXML2.XMLHttp.6.0', 'MSXML2.XMLHttp.3.0', 'MSXML2.XMLHttp' ]; for (var i = 0; version.length; i ++) { try { return new ActiveXObject(version[i]); } catch (e) { //跳过 } } } else { throw new Error('您的系统或浏览器不支持XHR对象!'); } }
全文详见:http://xpxw.com/?id=7