Go to Post Humility tends to take people places, pompous boasts tend to get people left at home by themselves. - Karthik [more]
Home
Go Back   Chief Delphi > Technical > IT / Communications > Website Design/Showcase
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Closed Thread
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 24-02-2007, 22:09
Compnerd's Avatar
Compnerd Compnerd is offline
Self-Proclaimed Nerd
AKA: James H
FRC #1444 (Lightning Lancers)
Team Role: Webmaster
 
Join Date: Jan 2007
Rookie Year: 2006
Location: St. Louis
Posts: 180
Compnerd has a spectacular aura aboutCompnerd has a spectacular aura about
Help: Looking for javascript countdown script

Hi everyone, I am looking for a countdown script using javascript. If you have one, please let me know!
__________________
James H. - Webmaster - Team 1444
http://www.first1444.com

If you need any website help send me a PM
  #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
  #3   Spotlight this post!  
Unread 24-02-2007, 22:25
fimmel's Avatar
fimmel fimmel is offline
Founding Mentor, Team 2370
AKA: Forest Immel
FRC #2370 (iBots 2370)
Team Role: Mentor
 
Join Date: Dec 2005
Rookie Year: 2005
Location: Castleton, Vermont
Posts: 325
fimmel has a reputation beyond reputefimmel has a reputation beyond reputefimmel has a reputation beyond reputefimmel has a reputation beyond reputefimmel has a reputation beyond reputefimmel has a reputation beyond reputefimmel has a reputation beyond reputefimmel has a reputation beyond reputefimmel has a reputation beyond reputefimmel has a reputation beyond reputefimmel has a reputation beyond repute
Re: Help: Looking for javascript countdown script

also Dynamic Drive has tins of cool javascript samples. here is one that does a countdown. http://www.dynamicdrive.com/dynamici...lcountdown.htm

/forest
__________________



  #4   Spotlight this post!  
Unread 24-02-2007, 23:44
pheadxdll pheadxdll is offline
Registered User
AKA: Alex
FRC #1225 (Amperage Robotics)
Team Role: Programmer
 
Join Date: Jan 2007
Rookie Year: 2006
Location: North Carolina
Posts: 168
pheadxdll has much to be proud ofpheadxdll has much to be proud ofpheadxdll has much to be proud ofpheadxdll has much to be proud ofpheadxdll has much to be proud ofpheadxdll has much to be proud ofpheadxdll has much to be proud ofpheadxdll has much to be proud ofpheadxdll has much to be proud of
Re: Help: Looking for javascript countdown script

Any of the above scripts are acceptable. Here's ours:

Code:
   
dateFuture = new Date(2007,2,28,24,0,0); // Set the date

function GetCount(){
    
    	dateNow = new Date();									//grab current date
    	amount = dateFuture.getTime() - dateNow.getTime();		//calc milliseconds between dates
    	delete dateNow;
    
    	// time is already past
    	if(amount < 0){
    		document.getElementById('countbox').innerHTML="Now!";
    	}
    	// date is still good
    	else{
    		days=0;hours=0;mins=0;secs=0;out="";
    
    		amount = Math.floor(amount/1000);//kill the "milliseconds" so just secs
    
    		days=Math.floor(amount/86400);//days
    		amount=amount%86400;
    
    		hours=Math.floor(amount/3600);//hours
    		amount=amount%3600;
    
    		mins=Math.floor(amount/60);//minutes
    		amount=amount%60;
    
    		secs=Math.floor(amount);//seconds
    
    		if(days != 0){out += days +" day"+((days!=1)?"s":"")+", ";}
    		if(days != 0 || hours != 0){out += hours +" hour"+((hours!=1)?"s":"")+", ";}
    		if(days != 0 || hours != 0 || mins != 0){out += mins +" minute"+((mins!=1)?"s":"")+", ";}
    		out += secs +" seconds";
    		document.getElementById('countbox').innerHTML=out + " until we attend the Palmetto Regional in SC!";
    
    		setTimeout("GetCount()", 1000);
    	}
    }

window.onload=function(){
    GetCount();
}
Make a div with an id countbox where you want the timer to be. Done!

Note: Its set currently to the Palmetto Regional, change the date to whatever you want
__________________
Amperage Robotics Team 1225
Site under-going revamp. :/
Closed Thread


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
looking for help on chairman award grandmother cul Chairman's Award 19 15-02-2008 09:27
Looking for help sfshilo General Forum 3 10-04-2006 18:30
Looking for help at UCF regionals Mike Norton Programming 2 26-02-2004 12:59
Looking for SECURE login script plutonium83 Website Design/Showcase 9 22-01-2004 14:40
Pit News - Looking for Help Nate Smith General Forum 0 13-03-2003 14:09


All times are GMT -5. The time now is 02:04.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi