[javascript]
function createXHR(){
if(typeof XMLHttpRequest != "undefined"){
return new XMLHttpRequest();
}else if(typeof ActiveXObject !== "undefined"){
if (typeof arguments.callee.activeXString != "string") {
var versions = ["MSXML2.XMLHttp.6.0", "MSXML2.XMLHttp.3.0", "MSXML2.XMLHttp"];
for(var i = 0, len = versions.length; i < len; i++){
try{
var xhr = new ActiveXObject(versions[i]);
arguments.callee.activeXString = versions[i];
return xhr;
}catch(e){}
}
}
return new ActiveXObject(arguments.callee.activeXString);
}else{
throw new Error("No XHR object avaliable.");
}
}
[/javascript]
您的赞助将会支持作者创作及本站运维
发表评论