JS计算网页停留时间代码
代码如下:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312"> <title>显示停留时间</title> </head> <body> <form name="form1" method="post" action=""> <center> <p><font size="5" color="#0000FF" face="华文细黑">您在本站已停留:</font></p> <p> <input name="textarea" type="text" value=""> </p> </center> <script language="javascript"> var second=0; var minute=0; var hour=0; window.setTimeout("interval();",1000); function interval() { second++; if(second==60) { second=0;minute+=1; } if(minute==60) { minute=0;hour+=1; } document.form1.textarea.value = hour+"时"+minute+"分"+second+"秒"; window.setTimeout("interval();",1000); } </script> </form> </body> </html>
相关推荐
拾毅者 2020-09-14
LxyPython 2020-08-17
chenhaimeimeng 2020-08-15
yaodilu 2020-01-06
似水流年梦 2019-12-03
bobboy00 2014-03-19
wangdoudou0 2015-07-20
MrWhite0 2016-05-03
huzijia 2019-05-18
古人云小程序 2019-04-30
yanghui0 2016-09-27
vavid 2012-11-22
88407013 2012-06-28
彼岸的云 2010-06-12
89520292 2011-07-27
82443365 2011-05-29
87457808 2014-05-17
owhile 2017-08-29
丁丁爸爸的技术 2017-01-10