Ajax之XMLHttpRequest对象几种方式的获取求解
展开全部
function ajaxFunction(){ var xmlHttp; try{ // Firefox, Opera 8.0+, Safari xmlHttp=new XMLHttpRequest(); } catch (e){ try{// Internet Explorer xmlHttp=new ActiveXObject("Msxml2.XMLHTTP"); } catch (e){ try{ xmlHttp=new ActiveXObject("Microsoft.XMLHTTP"); } catch (e){} } }return xmlHttp; }<2>////////////////////////////////////////////////////////////////////////////////////////////
function getXMLHttpRequest(){var xmlHttpReq=null; if (window.ActiveXObject) {//IE浏览器创建XMLHttpRequest对象xmlHttpReq = new ActiveXObject("MSXML2.XMLHTTP.3.0");}else if(window.XMLHttpRequest){xmlHttpReq = new XMLHttpRequest();} return xmlHttpReq;}<3>///////////////////////////////////////////////////////////////////////////////////////////
function getXMLHttpRequest() {var xmlHttpReq=null;if (window.XMLHttpRequest) {//Mozilla 浏览器xmlHttpReq = new XMLHttpRequest();}else {if (window.ActiveXObject) {//IE 浏览器try {xmlHttpReq = new ActiveXObject("Microsoft.XMLHTTP");}catch (e) {try {//IE 浏览器xmlHttpReq = new ActiveXObject("Msxml2.XMLHTTP");}catch (e) {}}}}return xmlHttpReq;}
function getXMLHttpRequest(){var xmlHttpReq=null; if (window.ActiveXObject) {//IE浏览器创建XMLHttpRequest对象xmlHttpReq = new ActiveXObject("MSXML2.XMLHTTP.3.0");}else if(window.XMLHttpRequest){xmlHttpReq = new XMLHttpRequest();} return xmlHttpReq;}<3>///////////////////////////////////////////////////////////////////////////////////////////
function getXMLHttpRequest() {var xmlHttpReq=null;if (window.XMLHttpRequest) {//Mozilla 浏览器xmlHttpReq = new XMLHttpRequest();}else {if (window.ActiveXObject) {//IE 浏览器try {xmlHttpReq = new ActiveXObject("Microsoft.XMLHTTP");}catch (e) {try {//IE 浏览器xmlHttpReq = new ActiveXObject("Msxml2.XMLHTTP");}catch (e) {}}}}return xmlHttpReq;}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询