Click to See Complete Forum and Search --> : Count down timer one hour
njirem
03-26-2003, 05:53 AM
I need a countdown timer of one hour, and when the hour is over it has to reset for next hour, so I can see exactely how many seconds it is before next hour.
Is this possible? How can I make that?
gil davis
03-26-2003, 06:16 AM
<head>
<script>
function secondsLeft() {
now = new Date()
mins = now.getMinutes();
secs = now.getSeconds();
document.f1.t1.value = 60 * 60 - (mins * 60 + secs);
}
function init() {
timer = setInterval("secondsLeft()", 1000);
}
</script>
</head>
<body onload="init()">
<form name="f1" onsubmit="return false">
There are <input type="text" name="t1" size=4> seconds left until the next hour.
</form>
</body>
njirem
03-26-2003, 06:54 AM
Thank you very much! That is exactely what I need!:D :)