Style 1a
Style 1a
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.
<head>
<style type="text/css">
.numbers {
width: 55px;
text-align: center;
font-family: Arial;
font-size: 28px;
font-weight: bold; /* options are normal, bold, bolder, lighter */
font-style: normal; /* options are normal or italic */
color: #FFFF00; /* change color using the hexadecimal color codes for HTML */
}
.title { /* the styles below will affect the title under the numbers, i.e., “Days”, “Hours”, etc. */
width: 55px;
text-align: center;
font-family: Arial;
font-size: 10px;
font-weight: bold; /* options are normal, bold, bolder, lighter */
color: #CCFF66; /* change color using the hexadecimal color codes for HTML */
}
#form {
width: 400px;
height: 68px;
border-style: none;
background-color: transparent;
}
#form input {
border: none;
background-color: transparent;
}
</style>
</head>
<body>
<form name="count" id="form">
<center>
<table>
<tr>
<td align="center" colspan="4"><input type="text" size="20" class="numbers" name="count2"></td>
</tr>
<tr>
<td align="center"><input type="text" class="numbers" name="dday"></td>
<td align="center" ><input type="text" class="numbers" name="dhour"></td>
<td align="center" ><input type="text" class="numbers" name="dmin"></td>
<td align="center" ><input type="text" class="numbers" name="dsec"></td>
</tr>
<tr>
<td align="center" ><input type="text" class="title" name="days" value="Days"></td>
<td align="center" ><input type="text" class="title" name="hours" value="Hours"></td>
<td align="center" ><input type="text" class="title" name="minutes" value="Minutes"></td>
<td align="center" ><input type="text" class="title" name="seconds" value="Seconds"></td>
</tr>
</table>
</center>
</form>
<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
and on 10/20/2007 to a new format
*/
//-->change the text below to reflect what you want the script to display when the target date and time are reached, limit to 20 characters
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;
document.forms.count.count2.style.display="block";
document.forms.count.count2.style.width="390px";
document.forms.count.dday.style.display="none";
document.forms.count.dhour.style.display="none";
document.forms.count.dmin.style.display="none";
document.forms.count.dsec.style.display="none";
document.forms.count.days.style.display="none";
document.forms.count.hours.style.display="none";
document.forms.count.minutes.style.display="none";
document.forms.count.seconds.style.display="none";
return;
}
else {
document.forms.count.count2.style.display="none";
document.forms.count.dday.value=dday;
document.forms.count.dhour.value=dhour;
document.forms.count.dmin.value=dmin;
document.forms.count.dsec.value=dsec;
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(2009,12,21,12,47)
</script>
</body>
Countdown to the start of Winter in the Northern Hemisphere: December 21, 2009; 12:47 PM EST
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.