var Http_Request;//http请求对象
var XMLDocument;//响应结果变量
function AjaxCls()
{
this.sendUrl="";//URL请求地址
//获得请求对象
this.getRequest=function()
{
Http_Request=null;
if(window.XMLHttpRequest)
{
Http_Request=new XMLHttpRequest();
if(Http_Request.overrideMimeType)
Http_Request.overrideMimeType("text/xml");
}
else
{
if(window.ActiveXObject)
{
try
{
Http_Request=new ActiveXObject("Msxml2.XMLHTTP");
}
catch(e)
{
try
{
Http_Request=new ActiveXObject("Microsoft.XMLHTTP");
}
catch(e)
{
Http_Request=null;
}
}
}
}
};
//获得响应对象
this.getXMLResponse=function()
{
//Http_Request.onreadystatechange=alertContents;
Http_Request.open("get",this.sendUrl,true);
Http_Request.send(null);
};
}
var oAjax=new AjaxCls();//创建Ajax的对象
function sendServerMessage()
{
oAjax.sendUrl="[要执行更新操作的ASP网页URL地址]";
oAjax.getRequest();
oAjax.getResponse();
window.setTimeout("sendServerMessage()",20000);//每隔20秒之行该函数一次
}
sendServerMessage();
[此贴子已经被作者于2007-9-12 13:09:04编辑过]