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

J

jodleren

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
}
 
E

Evertjan.

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();
 
J

jodleren

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
 
E

Evertjan.

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.
 

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,755
Messages
2,569,536
Members
45,013
Latest member
KatriceSwa

Latest Threads

Top