|
↑
Page Details >>>
If the other time on page scripts seem too impersonal for you, this could be your solution. Instead of the 00:00 readout, it displays 'X Secs'.
Add the below code to the <body> section of your page:
<script
language="javascript"
type="text/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("."))
+
" secs.";
document.Time.timespent.value
=
mySecs1
window.setTimeout('getSecs()',1000);
}
function
Go()
{
window.setTimeout('getSecs()',1)
}
window.onload
=
Go;
</script>
<FORM
name="Time">
<input
size=9
name=timespent>
</FORM>
|
→
|