View Single Post
  #2   Spotlight this post!  
Unread 24-02-2007, 22:21
Uberbots's Avatar
Uberbots Uberbots is offline
Mad Programmer
AKA: Billy Sisson
FRC #1124 (ÜberBots)
Team Role: College Student
 
Join Date: Jan 2006
Rookie Year: 2005
Location: Avon
Posts: 739
Uberbots has a reputation beyond reputeUberbots has a reputation beyond reputeUberbots has a reputation beyond reputeUberbots has a reputation beyond reputeUberbots has a reputation beyond reputeUberbots has a reputation beyond reputeUberbots has a reputation beyond reputeUberbots has a reputation beyond reputeUberbots has a reputation beyond reputeUberbots has a reputation beyond reputeUberbots has a reputation beyond repute
Re: Help: Looking for javascript countdown script

This is a simple function that i use on our website.
PHP Code:
function update(divIDseconds) {
        
obj document.getElementById(divID);
        var 
now = new Date();
        var 
output "";
        var 
dayshoursminutessecond;
        var 
timeUntil seconds Math.round(now.valueOf()/1000);
        
        
days Math.floor(timeUntil/86400);  timeUntil -= days*86400;
        
hours Math.floor(timeUntil/3600);  timeUntil -= hours*3600;
        
minutes Math.floor(timeUntil/60);  timeUntil -= minutes*60;
        
second Math.floor(timeUntil);
        
        
output += days " Days, " hours " Hours, " minutes " Minutes, " second " Seconds";
        
        
obj.innerHTML output;
        
window.setTimeout("update('" divID "', " seconds ")"1000);
    } 
You supply the ID of the tag you want to fill with the countdown, and the UNIX timestamp of the event that will be occurring. make sure that you set a preliminary timeout function before using it the first time. for example:
PHP Code:
window.setTimeout("update('feild0', 1173963600)"0); 
just for clarification, despite the tag, it is javascript.
__________________
A few of my favorite numbers:
175 176 177 195 230 558 716 1024 1071 1592 1784 1816
RPI 2012
BREAKAWAY