js统计网页在线时间的脚本
2008-04-24 00:00
537 查看
每xxxxx毫秒检测一次是否在线,
TR_COUNT次之后设定改用户为假死状态(即不在当前页面活动,afk..)
当页面关闭时把停留时间送出,
/**//* ----------------------------------------------------------------------------
* Script Name: online.js
* Last Modified: 2008-4-13 22:25
* Author: meyu
* Copyright (c) 2008
* Purpose: 跟踪在线时间
* ----------------------------------------------------------------------------*/
function TR_XMLHttpObject(url)...{
this.XMLHttp=null;
this.url=url;
this.init=function()...{
if(window.XMLHttpRequest)...{
this.XMLHttp=new XMLHttpRequest();
}else if(window.ActiveXObject)...{
this.XMLHttp=new ActiveXObject("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))...{
var TR_COUNT=0;
var TR_x=new TR_XMLHttpObject(window.location.href.replace(/&?(?:flush_count=)(d+)/i,
function(a,d)...{
TR_COUNT=parseInt(d);
return "";
})
);
function send()...{
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);};
}
TR_COUNT次之后设定改用户为假死状态(即不在当前页面活动,afk..)
当页面关闭时把停留时间送出,
/**//* ----------------------------------------------------------------------------
* Script Name: online.js
* Last Modified: 2008-4-13 22:25
* Author: meyu
* Copyright (c) 2008
* Purpose: 跟踪在线时间
* ----------------------------------------------------------------------------*/
function TR_XMLHttpObject(url)...{
this.XMLHttp=null;
this.url=url;
this.init=function()...{
if(window.XMLHttpRequest)...{
this.XMLHttp=new XMLHttpRequest();
}else if(window.ActiveXObject)...{
this.XMLHttp=new ActiveXObject("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))...{
var TR_COUNT=0;
var TR_x=new TR_XMLHttpObject(window.location.href.replace(/&?(?:flush_count=)(d+)/i,
function(a,d)...{
TR_COUNT=parseInt(d);
return "";
})
);
function send()...{
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);};
}
相关文章推荐
- js统计网页在线时间的脚本
- 用js统计用户下载网页所需时间的脚本
- 用js统计用户下载网页所需时间的脚本
- js统计在线学习时间
- Hybrid模式-利用AssetsManager实现在线更新脚本文件lua、js、图片等资源(免去平台审核周期)
- 统计用户在线时间的一种尝试
- js实现网站运行时间统计
- 网页中视频在线播放脚本
- 统计京东通信当前当页通话记录总时间脚本
- Hybrid模式-利用AssetsManager实现在线更新脚本文件lua、js、图片等资源(免去平台审核周期)
- 验证只输入时间的脚本和文本选中js脚本(兼容firefox)
- 统计符合条件的行数、查找最符合某个发生时间的log文件的脚本
- aspx页面运行纯js脚本的时间控件不能显示控件的解决办法
- js实现网页在线聊天功能(三)
- Jquery.media.js实现网页在线预览pdf文件
- shell脚本统计出日志文件操作以及其对应的平均时间
- js面试题:网页中实现一个计算还剩多少时间的倒数计时程序
- JS时间处理脚本 总结
- Linux ac --在线时间统计
- JS实现网页抢购功能(触发,终止脚本)