javaScript如何生成xmlhttp

来源:互联网 发布:java collection 编辑:程序博客网 时间:2024/04/29 09:01
代码如下:

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;
}
0 0