Trevor L. wrote:
> Digger wrote:
>> I am the webmaster for a High School Football Team
>> (www.dvfootball.com). I am looking for some (free or cheap) HTML
>> code to place a count-down clock on our website to signify our first
>> game... Can anyone send me or suggest a site where I can accomplish
>> my goal? Thanks
>
> I can write one for you.
>
> What do you want
Well, I made an executive decision as to what you wanted (or might want) and here is the script
There is one line you need to alter
var matchDate = new Date("Wed Aug 09 18:00:00 2006")
Type inside the brackets the correct date and time of the match, in the same format
(dayname monthname dayofmonth hours:minutes:seconds year)
matchdate.html
==========
<html>
<head>
<script type ="text/javascript">
var matchDate = new Date("Wed Aug 09 18:00:00 2006")
function getdate(){
var now = new Date()
var toGo = matchDate - now
var seconds = 1000
var minutes = seconds*60
var hours = minutes*60
var days = hours*24
var Days = parseInt(toGo / days)
toGo -= Days * days
var Hours = parseInt(toGo / hours)
toGo -= Hours * hours
var Minutes = parseInt(toGo / minutes)
toGo -= Minutes * minutes
var Seconds = parseInt(toGo / seconds)
function checkTime(i) {
if (i < 10)
i="0" + i
return i
}
document.getElementById("nowdate").innerHTML = now.toLocaleDateString()
document.getElementById("nowtime").innerHTML = checkTime(now.getHours())
+ ':' + checkTime(now.getMinutes())+ ':' + checkTime(now.getSeconds())
document.getElementById("togodate").innerHTML = matchDate.toLocaleDateString()
document.getElementById("togotime").innerHTML = checkTime(matchDate.getHours())
+ ':' + checkTime(matchDate.getMinutes()) + ':' + checkTime(matchDate.getSeconds())
document.getElementById("togodays").innerHTML = Days
document.getElementById("togohours").innerHTML = Hours
document.getElementById("togominutes").innerHTML = Minutes
document.getElementById("togoseconds").innerHTML = Seconds }
</script>
</head>
<body onload="getdate()">
<table style="background-color:aqua">
<tr><td>Current Date</td> <td><span id="nowdate"></span></td></tr>
<tr><td>Current Time</td> <td><span id="nowtime"></span></td></tr>
<tr><td>Match Date</td> <td><span id="togodate"></span></td></tr>
<tr><td>Match Time</td> <td><span id="togotime"></span></td></tr>
<tr><td>Days</td> <td><span id="togodays"></span></tr>
<tr><td>Hours</td> <td><span id="togohours"></span></td></tr>
<tr><td>Minutes</td> <td><span id="togominutes"></span></td></tr>
<tr><td>Seconds</td> <td><span id="togoseconds"></span></td></tr>
</table>
</body>
</html>
Have fun
--
Cheers,
Trevor L.
[ Microsoft MVP - FrontPage ]
MVPS Website:
http://trevorl.mvps.org/