Help - Search - Members - Calendar
Full Version: countdown script?
Weborum Webmaster Forum > Web Page Design > Javascript
CBrown
Does anyone know a good countdown script? Every one that I come across you can't style or it just dosen't work. Maybe I'm just not looking hard enough.

Thanks.
Joe
CODE
<script type="text/javascript">

/*
Annual Occasions Count Down script- By JavaScript Kit
For this and over 400+ free scripts, visit http://www.javascriptkit.com
This notice must stay intact
*/

var today=new Date()

//Enter the occasion's MONTH (1-12) and DAY (1-31):
var theoccasion=new Date(today.getFullYear(), 12, 25)

//Customize text to show before and on occasion. Follow grammer below:
var beforeOccasionText="left until Christmas"
var onOccasiontext="Today is Christmas. Happy Holidays!"

var monthtext=new Array("Jan","Feb","Mar","April","May","June","July","Aug","Sep","Oct","Nov","Dec")
theoccasion.setMonth(theoccasion.getMonth()-1) //change to 0-11 month format
var showdate="("+monthtext[theoccasion.getMonth()]+" "+theoccasion.getDate()+")" //show date of occasion

var one_day=1000*60*60*24
var calculatediff=""

calculatediff=Math.ceil((theoccasion.getTime()-today.getTime())/(one_day))
if (calculatediff<0){ //if bday already passed
var nextyeartoday=new Date()
nextyeartoday.setFullYear(today.getFullYear()+1)
calculatediff=Math.ceil((nextyeartoday.getTime()-today.getTime())/(one_day)+calculatediff)
}

//Display message accordingly
var pluraldayornot=(calculatediff==1)? "day" : "days"
if (calculatediff>0)
document.write("<b>"+calculatediff+" "+pluraldayornot+" "+beforeOccasionText+" "+showdate+"!</b>")
else if (calculatediff==0)
document.write("<b>"+onOccasiontext+" "+showdate+"!</b>")

</script>

<p align="center"><font face="arial" size="-2">This free script provided by<br>
<a href="http://javascriptkit.com">JavaScript Kit</a></font></p>


This can be easily edited smile.gif

*edited*
Willy Duitt
Joe;

Do me a favor please and correct the credits for that script... It's not your fault and I'm sure you are unaware but hypergurl is nothing but a plagiarizing byeatch whom steals others scripts, removes their credits and replaces with her own...

The true credits for that script should be:
QUOTE
/*
Annual Occasions Count Down script- By JavaScript Kit
For this and over 400+ free scripts, visit http://www.javascriptkit.com
This notice must stay intact
*/


And a link to the original script can be found below...
http://javascriptkit.com/script/script2/countbirth.shtml

Thanks;
.....Willy
Joe
Changed Willy, thanks for pointing it out smile.gif
CBrown
thanks guys... the only one I could find that actually worked was from dynamic drive, and the only thing that I could change was the font size. The code was a little outdated too.

Thanks again.
Waleed
this one didn't work?
Willy Duitt
QUOTE(CBrown @ Mar 6 2005, 12:01 PM)
thanks guys... the only one I could find that actually worked was from dynamic drive, and the only thing that I could change was the font size. The code was a little outdated too.

Thanks again.
[right][snapback]24104[/snapback][/right]


What do you want to countdown too, and/or display??
CBrown
Sorry... this one worked.

The one I was having trouble with was from Dynamic Drive.

Maybe I should have worded that better.
Waleed
long hours at Weborum do that to you.. don't worry. wink.gif
leo
QUOTE(Waleed Zuberi @ Mar 6 2005, 07:49 PM)
long hours at Weborum do that to you.. don't worry. wink.gif
[right][snapback]24117[/snapback][/right]



do your hours vary past 60 minutes waleed laugh.gif
CBrown
roflmao.gif

that took a second for me to get
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2009 Invision Power Services, Inc.