function getXMLHttpRequest(){
if(typeof XMLHttpRequest != "function"){
XMLHttpRequest=function(){
try{ return new ActiveXObject("Msxml2.XMLHTTP.6.0"); }catch(e){}
try{ return new ActiveXObject("Msxml2.XMLHTTP.3.0"); }catch(e){}
try{ return new ActiveXObject("Msxml2.XMLHTTP"); }catch(e){}
return false;
}
}
return new XMLHttpRequest();
}
本代码示例摘自《JavaScript DOM 编程艺术》,在此记录,作为备忘。