Quote:
Originally posted by evulish
And how do you do countdown things in HTML?
|
DHTML
or there's a simpler JavaScript script that goes something like this:
<SCRIPT LANGUAGE="JAVASCRIPT">
ccDayNow = new Date();
ccDayThen = new Date("January 4, 2003")
msPerDay = 24 * 60 * 60 * 1000 ;
timeLeft = (ccDayThen.getTime() - ccDayNow.getTime());
cc_daysLeft = timeLeft / msPerDay;
daysLeft = Math.floor(cc_daysLeft);
cc_hrsLeft = (cc_daysLeft - daysLeft)*24;
hrsLeft = Math.floor(cc_hrsLeft);
minsLeft = Math.floor((cc_hrsLeft - hrsLeft)*60);
document.write( ""+daysLeft+" days left until the 2003 FIRST Robotics Kickoff");
</SCRIPT>
<edit>But this one does not give you real-time counting. You need to refresh the page it's on. The DHTML one does countdown in real-time but the code is obviously much longer.</edit>