首页 > 编程 > JavaScript > 正文

javaScript如何生成xmlhttp

2019-11-20 21:27:18
字体:
来源:转载
供稿:网友
复制代码 代码如下:

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;
}
发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表