javascript显示用户停留时间的简单实例
人气:0复制代码 代码如下:
<script type="text/javascript">
var second = 0;
var minute = 0;
var hour = 0;
window.setInterval("OnlineStayTime();", 1000);
function OnlineStayTime() {
second++;
if (second == 60) {
second = 0;
minute++;
}
if (minute == 60) {
minute = 0;
hour++;
}
window.status = "停留时间" + hour + ":" + minute + ":" + second;
}
</script>
加载全部内容