Script Categories













Page Details >>> Top Clock.

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:

<script language="javascript" type="text/javascript">      
/* Visit http://www.yaldex.com/ for full source code
and get more free JavaScript, CSS and DHTML scripts! */
<!-- Begin
startday = new Date();
clockStart = startday.getTime();
function initStopwatch() {
var myTime = new Date();
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>
<FORM name="Time">
<input
size=5 name=timespent>
</FORM>

JavaScript Editor Get Advanced
JavaScript and Ajax Editor,
Validator and Debugger!

1st JavaScript Editor.



Code was highlighted by 1st JavaScript Editor (The Best JavaScript Editor!).




©