js统计网页在线时间的脚本_AJAX相关教程-查字典教程网
js统计网页在线时间的脚本
js统计网页在线时间的脚本
发布时间:2016-12-29 来源:查字典编辑
摘要:每xxxxx毫秒检测一次是否在线,TR_COUNT次之后设定改用户为假死状态(即不在当前页面活动,afk..)当页面关闭时把停留时间送出,/...

每xxxxx毫秒检测一次是否在线,

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);};

}

相关阅读
推荐文章
猜你喜欢
附近的人在看
推荐阅读
拓展阅读
  • 大家都在看
  • 小编推荐
  • 猜你喜欢
  • 最新AJAX相关学习
    热门AJAX相关学习
    编程开发子分类