综合考虑Internet Explorer和非Internet Explorer浏览器这两种情况:
<script type="text/javascript"> function createXMLHttpRequest(){ var xmlHttp; if(window.XMLHttpRequest){ xmlHttp=new XMLHttpRequest(); }else if(window.ActiveXObject){ try{ xmlHttp=new ActiveXObject("Msmxl2.XMLHTTP"); }catch(e){ xmlHttp=new ActiveXObject("Microosoft.XMLHTTP"); } } return xmlHttp; } </script>