Passing Arguments (JavaScript)

G

Galsaba

I am afraid I did not phrase my question right, so I changed it.
Here is my question:

I want to use checkForm function for 10 forms I have.
form1, form2....., form10.
How can I pass argument to
....
if (document.formX.firstName.value='John')
....
(formX will be form1 or form2, ...or form10 etc.)

function checkForm(A,B)
{
if (document.formX.firstName.value='John')
{
document.formX.amount.value=A
}
else
{
document.formX.amount.value=B
}
}

In the form I call the function by
onSubmit = checkForm(3,4)

Thanks,

Joe
 

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,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top