Occasionally, it might be interesting to show the visitor how long they have been on your page. So, you can use this script to write a clock to the screen that will tell them exactly that!
Add the below code to the <body> section of your page:
<scriptlanguage="javascript"type="text/javascript"> /* Visit http://www.yaldex.com/
for full source code
and get more free JavaScript, CSS and DHTML scripts! */
<!-- Begin startday =newDate(); clockStart =
startday.getTime(); function
initStopwatch(){ var
myTime =newDate(); return((myTime.getTime()-
clockStart)/1000);
} function
getSecs(){ var
tSecs =Math.round(initStopwatch()); var
iSecs =
tSecs %60; var
iMins =Math.round((tSecs-30)/60); var
sSecs =""+((iSecs
>9)?
iSecs :"0"+
iSecs); var
sMins =""+((iMins
>9)?
iMins :"0"+
iMins); document.Time.timespent.value=
sMins+":"+sSecs; window.setTimeout('getSecs()',1000);
} function
Go()
{ window.setTimeout('getSecs()',1)
} window.onload=
Go; // End --> </script> <FORMname="Time">
<input
size=5name=timespent>
</FORM>