TR_COUNT次之后设定改用户为假死状态(即不在当前页面活动,afk..)
当页面关闭时把停留时间送出,
/**//*----------------------------------------------------------------------------
*ScriptName:online.js
*LastModified:2008-4-1322:25
*Author:meyu
*Copyright(c)2008
*Purpose:跟踪在线时间
*----------------------------------------------------------------------------*/
functionTR_XMLHttpObject(url)...{
this.XMLHttp=null;
this.url=url;
this.init=function()...{
if(window.XMLHttpRequest)...{
this.XMLHttp=newXMLHttpRequest();
}elseif(window.ActiveXObject)...{
this.XMLHttp=newActiveXObject("Microsoft.XMLHTTP");
}
};
this.init();
this.sendData=function(param)...{
with(this.XMLHttp)...{
open('GET',this.url+(param||''),true);
send(null);
}
};
}
if(/flag=flush/i.test(window.location.search))...{
varTR_COUNT=0;
varTR_x=newTR_XMLHttpObject(window.location.href.replace(/&?(?:flush_count=)(d+)/i,
function(a,d)...{
TR_COUNT=parseInt(d);
return"";
})
);
functionsend()...{
TR_COUNT++;
if(TR_COUNT<120)...{
TR_x.sendData('&flush_count='+TR_COUNT);
}
}
window.setInterval(send,30000);
window.onunload=function()...{TR_x.sendData('&flush_count='+TR_COUNT);};
}