Where to get a countdown clock?

Where can I get a countdown clock similar to the one on

Hmm, did you try going to the one at

They seem to have a good one.

Use that one.

(it’s javascript; just steal it and do what all designers do: chalk it up as "inspiration")

Hmm, did you try going to the one at

They seem to have a good one.

Use that one.

(it’s javascript; just steal it and do what all designers do: chalk it up as "inspiration")

I’m not much of a coder per se…how do I go about taking theirs?

function test(){
	alert('test');
}

That’s such a useless function.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
<html dir="ltr" lang="en"> 
<head> 

<script type="text/javascript">
function StartCountDown(myDiv,myTargetDate){
	var dthen	= new Date(myTargetDate);
	var dnow	= new Date();
	ddiff		= new Date(dthen-dnow);
	gsecs		= Math.floor(ddiff.valueOf()/1000);
	CountBack(myDiv,gsecs);
}

function Calcage(secs, num1, num2){
	s = ((Math.floor(secs/num1))%num2).toString();
	if (s.length < 2){	
		s = "0" + s;
	}
	return (s);
}

function CountBack(myDiv, secs){
	var DisplayStr;
	
	if(Calcage(secs,86400,100000) > 0){
		var DisplayFormat = "%%D%% Days %%H%%:%%M%%:%%S%%";
	} else {
		var DisplayFormat = "%%H%%:%%M%%:%%S%%";
	}
	DisplayStr = DisplayFormat.replace(/%%D%%/g,	Calcage(secs,86400,100000));
	DisplayStr = DisplayStr.replace(/%%H%%/g,		Calcage(secs,3600,24));
	DisplayStr = DisplayStr.replace(/%%M%%/g,		Calcage(secs,60,60));
	DisplayStr = DisplayStr.replace(/%%S%%/g,		Calcage(secs,1,60));
	if(secs > 0){	
		document.getElementById(myDiv).innerHTML = DisplayStr;
		setTimeout("CountBack('" + myDiv + "'," + (secs-1) + ");", 990);
	}else{
		document.getElementById(myDiv).innerHTML = "Please refresh the page...";
		//window.location.reload();
	}
}

</script>

</head>
<body>

<div id="countdown">Countdown will be here..</div>

<script type="text/javascript">StartCountDown("countdown","02/14/2010 04:00 PM");</script>

</body>
</html>

I wound up writing this for him last night.

		<span id="countdown">Expires: <strong>December 1, 2009</strong></span>
		<script type="text/javascript" defer="defer">
			TimeZoneOffSet = -5; // Hours (EST = -5).
			window.TimeToMidnight=new Date();
			window.TimeToMidnight=parseInt(Date.parse("December 1, 2009")/1000)-parseInt(((window.TimeToMidnight.getTime())/1000)+(window.TimeToMidnight.getTimezoneOffset()*60)+(TimeZoneOffSet*60*60));
			function countdown() {
				var dd=Math.floor(window.TimeToMidnight/86400); 
				var hh=Math.floor((window.TimeToMidnight-(dd*86400))/3600)
				var min=Math.floor((window.TimeToMidnight-(dd*86400)-(hh*3600))/60)
				var ss=Math.floor((window.TimeToMidnight-(dd*86400)-(hh*3600)-(min*60)))
				hh=hh.toString();
				hh=(2==hh.length)?hh:'0'+hh;
				min=min.toString(); 
				min=(2==min.length)?min:'0'+min;
				ss=ss.toString();
				ss=(2==ss.length)?ss:'0'+ss;
				dd=(0==dd)?'':dd+((1==dd)?' Day ':' Days ');
				document.getElementById('countdown').innerHTML='Time Remaining: <strong>'+dd+hh+":"+min+":"+ss+'</strong>';
				window.TimeToMidnight=window.TimeToMidnight-1;
				if(window.TimeToMidnight<0) {
					top.location.href=location.href;
				}
				setTimeout('countdown()',1000);
			}
			countdown();
		</script>

I would have rather used PHP to figure out the duration of the countdown, mainly because not everybody has their DST and TZ settings properly set up, but whatever. It works. And it’s accurate enough. So that’s really all that matters.

dumpy ftw…the timer is fully functional, thank you man.

That’s heaps better.. *steals*.. i mean.. *gets inspired*..