View Full Version : Countdown timer
nelson
05-14-2009, 01:14 PM
I've added the countdown timer on the bottom of the splash (home page):
http://michaelbay.com/
1.- It appears on Safari on the Mac but not on Firefox.
2.- Is the timer visible on Firefox, IE, & Sadari on Windows XP/Vista?
Firefrost
05-14-2009, 01:30 PM
If the home page is the splash page then no on Firefox PC
Mindfreak87
05-14-2009, 01:36 PM
Works in Google Chrome but not the latest version of Firefox. [Windows XP][PC]
nelson
05-14-2009, 01:36 PM
Yes, splash = home.
Trailbreaker
05-14-2009, 02:32 PM
Firefox + XP, nothing.
nelson
05-14-2009, 02:44 PM
How about IE (Internet Explorer) Vista/XP ?
Mindfreak87
05-14-2009, 03:00 PM
IE Explorer v. 7.0.5730.13 works [Windows XP][PC]
Michael Do
05-14-2009, 03:02 PM
doesn't work on FF 3.0.10 (XP)
work on IE 8 (xp)
nelson
05-14-2009, 03:13 PM
:wtf
Ok, I give up. Usually it works on everything but IE. Now this time it wont appear on FF on Mac or PC.
Any help would greatly be appreciated!
littleman794
05-14-2009, 03:29 PM
lol, everyone is making girls there new avvy's, ill get in on this:D:D
The javascript console of Firefox gave the error message like this..
document.all has no properties
http://www.michaelbay.com/countdown.js
09 is not a legal ECMA-262 octal constant
countdown_clock (09, 06, 24, 00, 00, 1);
Maybe "document.all" references in the script are causing the problem. Found some links talking about this..
http://www.codingforums.com/archive/index.php/t-69468.html
http://www.webdeveloper.com/forum/showthread.php?t=128269
Fixed the script, This appears on IE, Firefox and safari (Vista).
function countdown_clock(year, month, day, hour, minute, format)
{
//I chose a div as the container for the timer, but
//it can be an input tag inside a form, or anything
//who's displayed content can be changed through
//client-side scripting.
html_code = '<div id="countdown"></div>';
document.write(html_code);
countdown(year, month, day, hour, minute, format);
}
function countdown(year, month, day, hour, minute, format)
{
Today = new Date();
Todays_Year = Today.getFullYear() - 2000;
Todays_Month = Today.getMonth() + 1;
//Convert both today's date and the target date into miliseconds.
Todays_Date = (new Date(Todays_Year, Todays_Month, Today.getDate(),
Today.getHours(), Today.getMinutes(), Today.getSeconds())).getTime();
Target_Date = (new Date(year, month, day, hour, minute, 00)).getTime();
//Find their difference, and convert that into seconds.
Time_Left = Math.round((Target_Date - Todays_Date) / 1000);
if(Time_Left < 0)
Time_Left = 0;
switch(format)
{
case 0:
//The simplest way to display the time left.
document.getElementById('countdown').innerHTML = Time_Left + ' seconds';
break;
case 1:
//More datailed.
days = Math.floor(Time_Left / (60 * 60 * 24));
Time_Left %= (60 * 60 * 24);
hours = Math.floor(Time_Left / (60 * 60));
Time_Left %= (60 * 60);
minutes = Math.floor(Time_Left / 60);
Time_Left %= 60;
seconds = Time_Left;
dps = 's'; hps = 's'; mps = 's'; sps = 's';
//ps is short for plural suffix.
if(days == 1) dps ='';
if(hours == 1) hps ='';
if(minutes == 1) mps ='';
if(seconds == 1) sps ='';
document.getElementById('countdown').innerHTML = days + ' day' + dps + ': ';
document.getElementById('countdown').innerHTML += hours + ' hour' + hps + ': ';
document.getElementById('countdown').innerHTML += minutes + ' minute' + mps + ': ';
document.getElementById('countdown').innerHTML += seconds + ' second' + sps;
break;
default:
document.getElementById('countdown').innerHTML = Time_Left + ' seconds';
}
//Recursive call, keeps the clock ticking.
setTimeout('countdown(' + year + ',' + month + ',' + day + ',' + hour + ',' + minute + ',' + format + ');',
1000);
}
nelson
05-14-2009, 09:26 PM
Thanks a lot Sora!
:D:D:D:D
Mindfreak87
05-14-2009, 09:34 PM
It works now in Firefox, well done Sora.
Trailbreaker
05-14-2009, 09:34 PM
There we go! Sora you are da bomb! :D
megatron42
05-14-2009, 11:26 PM
i can sse the timer just fine.. on XP
littleman794
05-15-2009, 02:42 PM
badda bing!!!!!!!!
it worrrkkks
nice. Was wondering where that went.