由于不同的浏览器创建xmlhttprequest 的方法不同所以应该用一些方法来创建一个兼容大多数浏览器的xmlhttpRequest对象,
代码






















还有一个用兼容老IE的写法
function createObj(){
var A=null;
try {
A=new ActiveXObject("Msxml2.XMLHTTP");
}
catch(e) {
try {
A=new ActiveXObject("Microsoft.XMLHTTP");
}
catch(oc) {
A=null;
}
}
if ( !A && typeof XMLHttpRequest != "undefined" ) {
A=new XMLHttpRequest();
}
return A;
}
var A=null;
try {
A=new ActiveXObject("Msxml2.XMLHTTP");
}
catch(e) {
try {
A=new ActiveXObject("Microsoft.XMLHTTP");
}
catch(oc) {
A=null;
}
}
if ( !A && typeof XMLHttpRequest != "undefined" ) {
A=new XMLHttpRequest();
}
return A;
}