473,385 Members | 1,769 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

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

Hi all!

I have this little nice part, which works in IE, but not in Firefox.
Can anyone help me?

It seems that one gets this error: form1.elements is not a function

What should I use instead?

BR
Sonnich

function directclick(input)
{
pos=input.indexOf("_");
form1 = document.forms[1];
form1.elements("aaa").value=input.substring(0,pos) ;
form1.elements("bbb").value=input.substring(pos+1) ;
form1.submit();
// this is not automatically called :(
DisableSubmits(); // my own func which disables submit buttons
}

Mar 27 '07 #1
3 2190
jodleren wrote on 27 mrt 2007 in comp.lang.javascript:
Hi all!

I have this little nice part, which works in IE, but not in Firefox.
Can anyone help me?

It seems that one gets this error: form1.elements is not a function

What should I use instead?

BR
Sonnich

function directclick(input)
{
pos=input.indexOf("_");
form1 = document.forms[1];
This your second form of the page?
form1.elements("aaa").value=input.substring(0,pos) ;
form1.elements['aaa'].value
form1.elements("bbb").value=input.substring(pos+1) ;
form1.elements['bbb'].value
form1.submit();


--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Mar 27 '07 #2
On Mar 27, 2:23 pm, "Evertjan." <exjxw.hannivo...@interxnl.netwrote:
jodleren wrote on 27 mrt 2007 in comp.lang.javascript:
function directclick(input)
{
pos=input.indexOf("_");
form1 = document.forms[1];

This your second form of the page?
yep, there are 2 forms. Could use one, if I by JS can create hidden
values. Form0 has one less than form2
>
form1.elements("aaa").value=input.substring(0,pos) ;

form1.elements['aaa'].value
form1.elements("bbb").value=input.substring(pos+1) ;

form1.elements['bbb'].value
Just asking - this works in IE too, or do I have to make a choise
here?

BR
Sonnich

Mar 27 '07 #3
jodleren wrote on 27 mrt 2007 in comp.lang.javascript:
form1.elements("aaa").value=input.substring(0,pos) ;

form1.elements['aaa'].value
form1.elements("bbb").value=input.substring(pos+1) ;

form1.elements['bbb'].value

Just asking - this works in IE too, or do I have to make a choise
here?
Did you test?

The [] is the standard, because:

form1.elements['bbb'].value

and

form1.elements.bbb.value

are equivalent.

elements("aaa") is wrong.

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Mar 27 '07 #4

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

Similar topics

3
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()">...
5
by: antonyliu2002 | last post by:
Hi, It looks like so many people are having problems with the javascript submit in firefox. I searched around, but haven't found a solution yet. Mostly, people were saying, try this or try...
5
by: Steve JORDI | last post by:
Just a question using images as submit buttons and PHP4.4.4. It seems that my code correctly works in FireFox but not in IExplorer. For example, I have a FORM with 2 buttons called "search" and...
2
by: mattgarvin | last post by:
Hello, I need a piece of javascript that will allow a form to be submitted when Enter is pressed for IE6 and 7, Firefox 2, and recent versions of Safari. It is for a login page that has two...
6
by: yawnmoth | last post by:
I'm trying to write a so-called bookmarklet for a specific web app and am having some difficulty. One of the names of a specific forms inputs is submit. As such, doing...
3
by: CAG | last post by:
Hello, I have following scenario in my web application. I want to load different web forms in single iframe. Iframe in contained in an ASP page. ASP page has “Submit” button, which submits iframe...
7
by: ddiabetes | last post by:
Hello, I have no javascript knowledge. I am responsible for a website that includes a small amount of javascript, that stops working in firefox. The script begins like this: <script = javascript>...
3
by: ccyarm | last post by:
Hello, I need to modify the following code to make it work with Firefox. It works perfectly well with IE. It seems to me that with Firefox all the form values are lost when the onUnload fires up. ...
5
by: hannie | last post by:
onKeyPress does not work in Firefox. If use tab to navigate each field and press "Enter" on "Next" button to submit form and process to the next form / page, IE works well even if without onKeyPress...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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...
0
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.