Categories:

Home / Free JavaScripts / Clocks, Calenders, And Timers / Here

Cut & Paste Counting how long one has stayed in your page
Credit: JavaScript Kit

Description: The below script will count the number of seconds a person has been to your webpage.

Example:

You have visited my page for:

seconds!

Directions: Simply cut and paste this script into the <body> tags of your page.

<table border="0">
<tr>
<td align="center"><font face="Arial"><strong>You have
visited my page for:</strong></font></td>
<td align="center"><form name="d">
<p><input type="text" size="8" name="d2"></p>
</form>
</td>
<td align="center"><font face="Arial"><strong>seconds!</strong></font></td>
</tr>
</table>

<script>
<!--
/*By George Chiang. (JK's ultimate JavaScript tutorial and free JavaScripts site!)
http://www.javascriptkit.com
Credit MUST stay intact for use*/
var milisec=0
var seconds=0
document.d.d2.value='0'
function display(){
if (milisec>=9){
milisec=0
seconds+=1
}
else
milisec+=1
document.d.d2.value=seconds+"."+milisec
setTimeout("display()",100)
}
display()
//-->
</script>


JavaScript Tools:
Site Info

CopyRight 1998-2012 JavaScript Kit. NO PART may be reproduced without author's permission.