Passing Arguments (JavaScript)

Discussion in 'HTML' started by Galsaba, Apr 4, 2004.

  1. Galsaba

    Galsaba Guest

    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
    Galsaba, Apr 4, 2004
    #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. Galsaba

    JavaScript - Passing Arguments

    Galsaba, Apr 4, 2004, in forum: HTML
    Replies:
    3
    Views:
    4,617
    Richard Cornford
    Apr 5, 2004
  2. Edward Diener
    Replies:
    14
    Views:
    4,875
    Josiah Carlson
    Apr 6, 2004
  3. Nathan Sokalski
    Replies:
    4
    Views:
    1,171
    Steve C. Orr [MVP, MCSD]
    Nov 20, 2006
  4. Nathan Sokalski

    Passing multiple arguments to the client-side JavaScript function in AJAX

    Nathan Sokalski, Nov 20, 2006, in forum: ASP .Net Building Controls
    Replies:
    4
    Views:
    236
    Steve C. Orr [MVP, MCSD]
    Nov 20, 2006
  5. oldyork90
    Replies:
    10
    Views:
    334
    Jorge
    Sep 27, 2008
Loading...

Share This Page