Firefox JavaScript Console Error: Form1 is not defined

Discussion in 'ASP .Net' started by Jon Natwick, Mar 1, 2005.

  1. Jon Natwick

    Jon Natwick Guest

    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
    Jon Natwick, Mar 1, 2005
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Jon Natwick
    Replies:
    3
    Views:
    17,918
    bruce barker
    Mar 1, 2005
  2. Mr Newbie

    Page Controls - FindControl - Form1

    Mr Newbie, Sep 16, 2005, in forum: ASP .Net
    Replies:
    2
    Views:
    2,697
    Mr Newbie
    Sep 16, 2005
  3. SQwilDude
    Replies:
    1
    Views:
    397
    =?Utf-8?B?UGV0ZXIgQnJvbWJlcmcgW0MjIE1WUF0=?=
    Jan 14, 2007
  4. Oodini
    Replies:
    1
    Views:
    1,751
    Keith Thompson
    Sep 27, 2005
  5. jodleren

    form1.submit(); in Firefox? Works in IE

    jodleren, Mar 27, 2007, in forum: Javascript
    Replies:
    3
    Views:
    130
    Evertjan.
    Mar 27, 2007
Loading...

Share This Page