//获取xmlHttp对象 function createXMLHttp() { var xmlHttp; //对于大多数浏览器适用 if (window.XMLHttpRequest()) { xmlHttp = new XMLHttpRequest(); } //考虑浏览器的兼容性 if (window.ActiveXObject) { xmlHttp = new ActiveXObject("Microsoft.XMLHTTP"); if (!xmlHttp) { xmlHttp = new ActiveXObject("Msxml2.XMLHTTP"); } } return xmlHttp; }
原文:http://www.cnblogs.com/save-shengfei/p/6043250.html