Countdown Clock Help

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:

  1. How can I remove the days feature from the clock.

  2. 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

I was also wondering, does this script use the users local time zone or will it use the severs time zone? That way I can assure that it will be counting down to 12:00pm Eastern time rather than 12:00pm the users time.

I would think that since js is a client language, it would use the client time.

  1. How can I remove the days feature from the clock.

Just remove everything that has with day to do such as

count=Math.floor(count/24);
cl.days.value=count;

  1. 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.

yeah first of, set the eventday with getFullYear(), getMonth() and so on
then in the if-statment that sets the counter to –
remove that and set eventdate to be eventday + 1 day

and the time is clientside, you could probobly make a workaround with php
google for “javascript and php”

you could use .getTimezoneOffset() and set the eventdate diffrent depending witch timezon the have