演
示
源
代
码
记录浏览时间(1)
注释:放在<body****>里
注释:放在<body>与</body>之间
<script language="JavaScript"> startday = new Date(); clockStart = startday.getTime(); function initStopwatch() { var myTime = new Date(); var timeNow = myTime.getTime(); var timeDiff = timeNow - clockStart; this.diffSecs = timeDiff/1000; return(this.diffSecs); } function getSecs() { var mySecs = initStopwatch(); var mySecs1 = ""+mySecs; mySecs1= mySecs1.substring(0,mySecs1.indexOf(".")) + " 秒 "; document.form1.timespent.value = mySecs1 window.setTimeout('getSecs()',1000); } </script> <form name=form1> <input size=6 name=timespent> </form>
当前位置:
首 页
→
JavaScript
→
日期时间
→记录浏览时间(1)
··万旭网站工作室 设计发布··