Firefox JavaScript Console Error: Form1 is not defined

J

Jon Natwick

This "Countdown Timer" code works fine with Ie, but I receive an "Error:
Form1 is not defined" error with Firefox 1.0.0 and 1.0.1.

<body MS_POSITIONING="FlowLayout" onload="InitializeTimer()">
<form name="Form1" method="post" action="test.aspx" id="Form1">

<script language=JavaScript> var mins, secs, timerID = null, timerRunning =
false, delay = 1000; function InitializeTimer() { mins =
Form1.tbMins.value;
secs = Form1.tbSecs.value; StopTheClock(); StartTheTimer(); } function
StopTheClock() { if(timerRunning) clearTimeout(timerID); timerRunning =
false; } function display(min, sec) { var disp; if(min<=9) disp=' 0';
else
disp=' '; disp += min + ':'; if(sec<=9) disp += '0' + sec; else disp +=
sec;
return(disp); } function decrement() { secs--; if(secs == -1) { secs =
59;
mins--; } } function StartTheTimer() { if (mins == 0 && secs == 0) {
document.Form1.hTimer.value = display(mins, secs); self.status =
display(mins, secs); StopTheClock(); } else {
document.Form1.hTimer.value =
display(mins, secs); self.status = display(mins, secs); decrement();
timerRunning = true; timerID = self.setTimeout('StartTheTimer()',
delay); } } } </script>

Any ideas??

If I take out the Form1 prefix, it doesn't work in either Ie or Firefox.

Thanks in advance,
Jon
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,754
Messages
2,569,521
Members
44,995
Latest member
PinupduzSap

Latest Threads

Top