Hey guys,
I’ve been messing with a countdown clock script…
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<SCRIPT LANGUAGE="JavaScript">
<!--
var eventdate = new Date("January 21, 2010 16:55:00");
function toSt(n) {
s=""
if(n<10) s+="0"
return s+n.toString();
}
function countdown() {
cl=document.clock;
d=new Date();
count=Math.floor((eventdate.getTime()-d.getTime())/1000);
if(count<=0)
{cl.days.value ="----";
cl.hours.value="--";
cl.mins.value="--";
cl.secs.value="--";
return;
}
cl.secs.value=toSt(count%60);
count=Math.floor(count/60);
cl.mins.value=toSt(count%60);
count=Math.floor(count/60);
cl.hours.value=toSt(count%24);
count=Math.floor(count/24);
cl.days.value=count;
setTimeout("countdown()",500);
}
// end hiding script-->
</SCRIPT>
</head>
<body onLoad="countdown()">
<FORM name="clock">
<TABLE BORDER=5 CELLSPACING=5 CELLPADDING=0 BGCOLOR="#000000">
<TR>
<TD ALIGN=CENTER><INPUT name="days" size=2></TD>
<TD ALIGN=CENTER><INPUT name="hours" size=2></TD>
<TD ALIGN=CENTER><INPUT name="mins" size=2></TD>
<TD ALIGN=CENTER><INPUT name="secs" size=2></TD>
</TR>
</TABLE>
</FORM>
</body>
</html>
And was wondering if somebody could help me figure 2 things out:
-
How can I remove the days feature from the clock.
-
Is there a way I can have the counter countdown to 12:00pm everyday day?
So when 0 is reached it doesn’t just stop, it’ll reset and countdown to 12:00pm again.
Any help or a nudge in the right direction would be greatly appreciated.
Thanks,
Mario