很多浏览器允许直接创建XMLHTTPRequest对象,此脚本演示了在不同情况下创建XMLHTTPRequest的方法,脚本会不断尝试各种方法创建,知道创建成功
创建xmlhttprequest对象的方法
try {
req = new XMLHttpRequest(); /* e.g. Firefox */
} catch(e) {
try {
req = new ActiveXObject(\"Msxml2.XMLHTTP\"); /* some versions IE */
} catch (e) {
try {
req = new ActiveXObject("Microsoft.XMLHTTP"); /* some versions IE */
} catch (E) {
req = false;
}
}
}


