首页 >web前端 >js教程 >javascript显示用户停留时间的简单实例_javascript技巧

javascript显示用户停留时间的简单实例_javascript技巧

WBOY
WBOY原创
2016-05-16 17:26:531242浏览
复制代码 代码如下:

<script> <BR>var second = 0; <BR>var minute = 0; <BR>var hour = 0; <BR>window.setInterval("OnlineStayTime();", 1000); <BR>function OnlineStayTime() { <BR>second++; <BR>if (second == 60) { <BR>second = 0; <BR>minute++; <BR>} <BR>if (minute == 60) { <BR>minute = 0; <BR>hour++; <BR>} <BR>window.status = "停留时间" + hour + ":" + minute + ":" + second; <BR>} <BR></script> 
声明:
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn