关于XMlHttpRequest对象

//创建XMLHttpRequest对象的三种方法
1
var xhr = createXMLHttpRequest(); 2 function createXMLHttpRequest(){ 3 try{       return new XMLHttpRequest(); 5 }catch(e){ 6 try{ 7 return new ActiveXObject("Microsoft.XMLHTTP"); 8 }catch(e){ 9 try{ 10 return new ActiveXObject("Msxml2.XMLHTTP"); 11 }catch(e){ 12 alert("create XMLHTTPRequest object error!"); 13 } 14 } 15 } 16 } 17

猜你喜欢

转载自www.cnblogs.com/lss24/p/10003629.html