Forum Moderators: open

Message Too Old, No Replies

Countback till newyear

how to do that.

         

ikbenhet1

10:16 am on Dec 2, 2002 (gmt 0)

10+ Year Member



Is it possible to have a clock that will count back till newyear on my site?

Ex: 304 Hours 24 Minutes and 34 seconds left. (and counting down)

SuzyUK

10:35 am on Dec 2, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Yes...but you need to use a javascript many of which are available for free...(just search google for "javascript countdown clock" )

I found quite a good (and alterable) one here It was built for Y2K, but just change the date when promted to get the code you require

[websmith.demon.co.uk...]

Suzy

[edit] until I tried to leave the page and got one of those annoying pop-up alerts!...but this could be edited out of the code :)[/edit]

[edited by: SuzyUK at 10:40 am (utc) on Dec. 2, 2002]

seindal

10:36 am on Dec 2, 2002 (gmt 0)

10+ Year Member



It should be fairly easy to do in javascript.

René.

ikbenhet1

11:10 am on Dec 2, 2002 (gmt 0)

10+ Year Member



thanks, i found this working.

<b>
<font color=blue>

<form name="abcdef">
Nog
<input type="text" style="color: purple;font-weight: bold;" name="c" size=2 value=""> dagen,
<input type="text" style="color: purple;font-weight: bold;" name="d" size=2 value=""> uren,
<input type="text" style="color: purple;font-weight: bold;" name="e" size=2 value=""> minuten, en
<input type="text" style="color: purple;font-weight: bold;" name="f" size=2 value=""> seconden
tot Nieuw Jaar!
</form>
</b>
<script language="JavaScript">

<!--
// please keep these lines on when you copy the source
// made by: Nicolas - www.javascript-page.com

var Temp2;
var timerID = null;
var timerRunning = false;

var timerID = null;
var timerRunning = false;

function stopclock () {
if(timerRunning)
clearTimeout(timerID);
timerRunning = false;

}

function startclock () {
stopclock();
showtime();

}

function showtime() {

now = new Date();
var CurHour = now.getHours();
var CurMinute = now.getMinutes();
var CurMonth = now.getMonth();
var CurDate = now.getDate();
var CurSecond = now.getSeconds();
now = null;
var Hourleft = 23 - CurHour
var Minuteleft = 59 - CurMinute
var Secondleft = 59 - CurSecond
var Dateleft = 31 - CurDate

document.abcdef.c.value = Dateleft
document.abcdef.d.value = Hourleft
document.abcdef.e.value = Minuteleft
document.abcdef.f.value = Secondleft

timerID = setTimeout("showtime()",1000);
timerRunning = true;
}

startclock();
// -->

</script>
</font>