aax 대상을 만들고 여러 브라우저를 호환합니다

1093 단어
 
  
<br>function createAjax(){ <br>var request=false; <br>//window XMLHttpRequest IE, (IE7 ) <br>if(window.XMLHttpRequest){ <br>request=new XMLHttpRequest(); <br>if(request.overrideMimeType){ <br>request.overrideMimeType("text/xml"); <br>} <br>//window ActiveXObject IE <br>}else if(window.ActiveXObject){ <br>var versions=['Microsoft.XMLHTTP', 'MSXML.XMLHTTP', 'Msxml2.XMLHTTP.7.0','Msxml2.XMLHTTP.6.0','Msxml2.XMLHTTP.5.0', 'Msxml2.XMLHTTP.4.0', 'MSXML2.XMLHTTP.3.0', 'MSXML2.XMLHTTP']; <br>for(var i=0; i<versions.length; i++){ <br>try{ <br>request=new ActiveXObject(versions[i]); <br>if(request){ <br>return request; <br>} <br>}catch(e){ <br>request=false; <br>} <br>} <br>} <br>return request; <br>} <br>var ajax=createAjax(); <br>alert(ajax); <br>

좋은 웹페이지 즐겨찾기