#2
弱弱的初学者2006-06-26 23:45
|
function AjaxObj()
{
this.PoolContent = 10;
this.XmlHttpObjList = new Array(this.PoolContent);
this.CreateXmlHttpObj = JS_CreateXmlHttpObj;
this.getXmlHttpObj = JS_getXmlHttpObj;
}
function JS_CreateXmlHttpObj()
{
var xmlHttp = false;
/*@cc_on @*/
/*@if (@_jscript_version >= 5)
try {
xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try {
xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
} catch (e2) {
xmlHttp = false;
}
}
@end @*/
if (!xmlHttp && typeof(XMLHttpRequest)!="undefined") {
xmlHttp = new XMLHttpRequest();
}
return xmlHttp;
}
function JS_getXmlHttpObj()
{
for(var i=0;i<this.PoolContent;i++)
{
if(this.XmlHttpObjList[i] == null)
{
return (this.XmlHttpObjList[i]=this.CreateXmlHttpObj());
}
else
{
if(this.XmlHttpObjList[i].readyState == 4 || this.XmlHttpObjList[i].readyState == 0)
{
return this.XmlHttpObjList[i];
}
else
{
continue;
}
}
}
alert("网络状态正忙,请稍后再试!");
}