0 Replies - 2482 Views - Last Post: 27 November 2001 - 02:20 AM

#1 Ruck  Icon User is offline

  • $

Reputation: -5
  • View blog
  • Posts: 1,033
  • Joined: 03-September 01

JavaScript Countdown.

Posted 27 November 2001 - 02:20 AM

Okay.. I've got this countdown counter on the main page of my site.. and for some reason (And only with Windows users) a runtime error is popping up.

The other odd thing.. is the counter still flippin' works.

Well anyway.. here's the code:

function start()
{
setup(document.forms["form1"].time2.value,"form1");
repeat()
}

start();

function repeat() { down("form1"); setTimeout("repeat()",1000); }

function setup(day,box) { today = (new Date()).getTime(); the_day = (new Date(day)).getTime(); time = (the_day - today); document.forms[box].time2.value=time; }

function down(box) { document.forms[box].time2.value = document.forms[box].time2.value - 1000; time = document.forms[box].time2.value; days = (time - (time % 86400000)) / 86400000; time = time - (days * 86400000); hours = (time - (time % 3600000)) / 3600000; time = time - (hours * 3600000); mins = (time - (time % 60000)) / 60000; time = time - (mins * 60000); secs = (time - (time % 1000)) / 1000; if(days==1) out = "1 day, "; else out = days+" days, "; if(hours < 10) out = out+"0"; out = out+hours+":"; if(mins < 10) out = out+"0"; out = out+mins+":"; if(secs < 10) out = out+"0"; out = out+secs; if(days+hours+mins+secs > 1) document.forms[box].time.value = out; else document.forms[box].time.value = ("No more school!"); }

The error is happening somewhere in here:
{
setup(document.forms["form1"].time2.value,"form1");
repeat()
}
I'm completely clueless here guys.
It works perfectly on my browser (Mac IE 5).


(Counter is located here.)


Is This A Good Question/Topic? 0
  • +

Page 1 of 1