473,748 Members | 8,530 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Firefox JavaScript Console Error: Form1 is not defined

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="Initial izeTimer()">
<form name="Form1" method="post" action="test.as px" id="Form1">

<script language=JavaSc ript> var mins, secs, timerID = null, timerRunning =
false, delay = 1000; function InitializeTimer () { mins = Form1.tbMins.va lue;
secs = Form1.tbSecs.va lue; StopTheClock(); StartTheTimer() ; } function
StopTheClock() { if(timerRunning ) clearTimeout(ti merID); 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
Nov 19 '05 #1
3 3915
Instead of 'Form1', try something like document.getEle mentById('Form1 ').
Maybe store it in a local variable if you need it multiple times.

"Jon Natwick" <no**********@y ahoo.com> wrote in message
news:zO******** *********@twist er.rdc-kc.rr.com...
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="Initial izeTimer()">
<form name="Form1" method="post" action="test.as px" id="Form1">

<script language=JavaSc ript> var mins, secs, timerID = null, timerRunning
= false, delay = 1000; function InitializeTimer () { mins =
Form1.tbMins.va lue; secs = Form1.tbSecs.va lue; StopTheClock();
StartTheTimer() ; } function StopTheClock() { if(timerRunning )
clearTimeout(ti merID); 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

Nov 19 '05 #2
Or document.all["Form1"], or document.forms[0] (afaik).

----
- Wilco Bauwer
Blog & Custom Controls @ http://wilcoding.xs4all.nl

Nov 19 '05 #3
to access the form you can use

any browser:

document.Form1
document.forms['Form1']
document.forms[0] // if first or only form

modern browsers

document.getEle mentsByName('Fo rm1')[0]
document.getEle mentById('Form1 ') // requires id tag

ie only:

Form1
document.all('F orm1')
-- bruce (sqlwork.com)


"Jon Natwick" <no**********@y ahoo.com> wrote in message
news:zO******** *********@twist er.rdc-kc.rr.com...
| 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="Initial izeTimer()">
| <form name="Form1" method="post" action="test.as px" id="Form1">
|
| <script language=JavaSc ript> var mins, secs, timerID = null, timerRunning
=
| false, delay = 1000; function InitializeTimer () { mins =
Form1.tbMins.va lue;
| secs = Form1.tbSecs.va lue; StopTheClock(); StartTheTimer() ; } function
| StopTheClock() { if(timerRunning ) clearTimeout(ti merID); 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
|
|
Nov 19 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
2217
by: LRW | last post by:
(Sorry if this is a repost...my newsreader keeps crashing on the posting--I don't know if the message going out or not) For some reason this javascript just won't work in Firefox. It works fine in IE, though. I know, IE is a bit more permissive than IE, and sometimes lets errors work when they shouldn't. But from what I can see, I just don't see what's wrong.
0
275
by: Jon Natwick | last post by:
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;...
6
14463
by: Mark Olbert | last post by:
The doPostBack javascript functioning is not submitting the page when called by linkbuttons (or an autopostback checkbox, for that matter). I'm aware of a problem with Netscape browsers and the postback code, but I have a workaround for that installed (and it looks like the code generated by ASP.NET when it renders the page does the same thing, namely, setting document<). However, the problem still exists under firefox. Has anyone come...
35
2074
by: Aaron Gray | last post by:
Hi, I have some code I just cannot seem to get to work properly on FireFox. It is probably something simple. On FireFox the following code does not seem to terminate in the browser, but it works fine on IE :- http://angray.members.beeb.net/Test/Test5.html
25
9273
by: Frances | last post by:
I have an html file, checked css syntax online (http://jigsaw.w3.org/css-validator/validator-uri.html.en) it all checks fine, got no errors or warnings.. however Firefox is not reading stylesheet, for some reason.. two examples of errors I get in JS console: Error: Unexpected end of file while searching for closing } of invalid rule set.
11
3431
by: minnesotti | last post by:
Hi there, I subscribed to a photographic pictures-hosting website which is heavy on JavaScript. My preferred latest browser Mozilla Firefox does not work with it -- no pictures are displayed and no buttons react to clicking. The website's helpdesk says it should work with Firefox, and could not offer any more advices. The JavaScript Console shows that there are numerous errors occuring. It looks like the web browser does not recognise...
1
2445
by: Larax | last post by:
Alright, so here's the problem. I define a global variable in my script and then add methods/properties to it. Everything works great, no error in Javascript Console. But when I refresh site, several errors "variable is not defined" are displayed. What is more strange, the script is still working ! After each another refresh these errors are keep showing, only after I close site and open it again, these errors disappear, but only to next...
2
9137
by: Altman | last post by:
I have created an ascx control and I am calling registerclientscriptblock. The path to the js file is relative to the aspx page and not the ascx file. The function runs fine in IE7 but in Firefox the error console says that the function is not defined. I tried making a very basic js file to get it to work and I am having the same problem. My js file is as follows function testjs() { alert("test fired");
0
8989
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8828
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9537
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9319
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
6073
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4599
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4869
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3309
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2780
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.