Style 2b

Show/Hide 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
*/

 

<head>

<style type="text/css">

#count2 {

    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 */

    }

</style>

</head>


<body>

<div style="text-align: center;">

    <div style="margin-left: auto; margin-right: auto; text-align: center; position: relative; ">

        <form name="count">

        <input type="text" size="47" id="count2" name="count2">

        </form>

    </div>

</div>


<script>


/*

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

*/



//-->change the text below to reflect what you want the script to display when the target date and time are reached,

var current="Winter has arrived!"

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 todaystring=montharray[todaym]+" "+todayd+", "+todayy+" "+todayh+":"+todaymin+":"+todaysec

futurestring=montharray[m-1]+" "+d+", "+yr+" "+hr+":"+min

dd=Date.parse(futurestring)-Date.parse(todaystring)

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

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

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

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.forms.count.count2.value=current

return

}

else

document.forms.count.count2.value=+dday+ " days, "+dhour+" hours, "+dmin+" minutes, and "+dsec+" seconds"

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

}


//-->enter the count down target date and time using the format year,month,day,hour (24 hour clock),minute

countdown(2008,12,21,7,04)

</script>

</body>

Countdown to the start of Winter in the Northern Hemisphere: December 21, 2008; 7:04 AM EST

Select the code by clicking on the "Select entire code" button, then copy it and insert it in an HTML Snippet to get the countdown timer shown above.  The code is repeated below with color coding to show what you can change.

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.