[復制此代碼]CODE:
// AJax類
function AJaxRequest() {
var XMLObj = false;
var CBfunc,ObJSelf;
ObJSelf=this;
try { xmlObj=new XMLHttpRequest; }
catch(e) {
try { xmlObj=new ActiveXObject("MSXML2.XMLHTTP"); }
catch(e2) {
try { xmlObj=new ActiveXObject("Microsoft.XMLHTTP"); }
catch(e3) { XMLObj=false; }
}
}
if (!XMLObj) return false;
this.method="POST";
this.url;
this.async=true;
this.content="";
this.callback=function(cbobj) {return;}
this.send=function() {
if(!this.method||!this.url||!this.async) return false;
XMLObj.open (this.method, this.url, this.async);
if(this.method=="POST") XMLObj.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
XMLObj.onreadystatechange=function() {
if(XMLObj.readyState==4) {
if(XMLObj.status==200) {
ObJSelf.callback(XMLObj);
}
}
}
if(this.method=="POST") XMLObj.send(this.content);
else XMLObj.send(null);
}
}