Style 2B

Show Terms of Use
You may freely use any script found on this site on both personal & commercial webpages. However, you may not sell the scripts or redistribute the scripts by, for example, putting them on another script archive or CD ROM.
If you use any of the scripts, the following credits included in the code must remain intact:
/*
Count down until any date script-
By JavaScript Kit (www.javascriptkit.com)
Over 200+ free scripts here!
Modified by Robert M. Kuhnhenn, D.O.
on 5/30/2006 to count down to a specific date AND time
and on 10/20/2007 to a new format, and 1/10/2010 to include
time zone offset.
*/

 

Step 1:  insert the following into the head element

Select the code by clicking on the "Select entire code" button, then copy it and insert it within the head element of your page (between <head> and </head>) to get the countdown timer shown above.  The code is repeated below with color coding to show what you can change.

<html>

<head>

<style type="text/css">

#count {

    border-style: ridge;    /* options are none, dotted, dashed, solid, double, groove, ridge, inset, outset */

    border-width: 2px;

    border-color: #666666/* change color of the border using the hexadecimal color codes for HTML */

    padding: 4px;           /* change the spacing between the timer and the border */

    text-align: center;

    font-family: Arial;

    font-size: 22px;        /* change the size of the font */

    font-weight: normal;    /* options are normal, bold, bolder, lighter */

    font-style: normal;     /* options are normal or italic */

    color: #FFFFFF;    /* change color using the hexadecimal color codes for HTML */

    background-color: #222222;    /* change the background color using the hex color codes for HTML */

    margin: 0px auto;

    position: relative;    /* leave as "relative" to keep timer centered on your page, or change to "absolute" then change the values of the "top" and "left" properties to position the timer */

    top: 0px;        /* change to position the timer */

    left: 0px;       /* change to position the timer; delete this property and it's value to keep timer centered on page */

    width: 582px;

    height: auto;

}

</style>


<script type="text/javascript">


/*

Count down until any date script-

By JavaScript Kit (www.javascriptkit.com)

Over 200+ free scripts here!

Modified by Robert M. Kuhnhenn, D.O.

on 5/30/2006 to count down to a specific date AND time,

on 10/20/2007 to a new format, and 1/10/2010 to include

time zone offset.

*/


/*  Change the items below to create your countdown target date and announcement once the target date and time are reached.  */

var current="Winter is here!";    //-->enter what you want the script to display when the target date and time are reached, limit to 20 characters

var year=2010;    //-->Enter the count down target date YEAR

var month=12;      //-->Enter the count down target date MONTH

var day=21;       //-->Enter the count down target date DAY

var hour=18;      //-->Enter the count down target date HOUR (24 hour clock)

var minute=38;    //-->Enter the count down target date MINUTE

var tz=-5;        //-->Offset for your timezone in hours from UTC (see http://wwp.greenwichmeantime.com/index.htm to find the timezone offset for your location)


//-->    DO NOT CHANGE THE CODE BELOW!    <--

var montharray=new Array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec");


function countdown(yr,m,d,hr,min){

theyear=yr;themonth=m;theday=d;thehour=hr;theminute=min;

    var today=new Date();

    var todayy=today.getYear();

    if (todayy < 1000) {todayy+=1900;}

    var todaym=today.getMonth();

    var todayd=today.getDate();

    var todayh=today.getHours();

    var todaymin=today.getMinutes();

    var todaysec=today.getSeconds();

    var todaystring1=montharray[todaym]+" "+todayd+", "+todayy+" "+todayh+":"+todaymin+":"+todaysec;

    var todaystring=Date.parse(todaystring1)+(tz*1000*60*60);

    var futurestring1=(montharray[m-1]+" "+d+", "+yr+" "+hr+":"+min);

    var futurestring=Date.parse(futurestring1)-(today.getTimezoneOffset()*(1000*60));

    var dd=futurestring-todaystring;

    var dday=Math.floor(dd/(60*60*1000*24)*1);

    var dhour=Math.floor((dd%(60*60*1000*24))/(60*60*1000)*1);

    var dmin=Math.floor(((dd%(60*60*1000*24))%(60*60*1000))/(60*1000)*1);

    var dsec=Math.floor((((dd%(60*60*1000*24))%(60*60*1000))%(60*1000))/1000*1);

    if(dday<=0&&dhour<=0&&dmin<=0&&dsec<=0){

        document.getElementById('count').innerHTML=current;

        return;

    }

    else {

        document.getElementById('count').innerHTML=+dday+ " days, "+dhour+" hours, "+dmin+" minutes, and "+dsec+" seconds";

        setTimeout("countdown(theyear,themonth,theday,thehour,theminute)",1000);

    }

}

</script>


</head>


<body onload="countdown(year,month,day,hour,minute);">

    <div id="count"></div>


</body>

</html>

Step 4:  format the countdown timer

You can change some of the formating by changing the items marked below in yellow.  You must also change the items in light blue to reflect what you want the script to display when the target date and time are reached and to set the target date and time.  Comments are noted in magenta.  To adjust the position of the counter in the page, change the "position," "top," and "left" values under "#count" in the CSS formating as noted in the comments below.

Step 2:  insert the following into the body element

Select the code by clicking on the "Select entire code" button, then copy it and insert it within the body element of your page (between <body> and </body>).

Step 3:  add an onload event to the body tag

Insert "countdown(year,month,day,hour,minute)"  into the body's onload event.