javascript onclick event on submit button- why does this happen?

Discussion in 'Javascript' started by bbcrock@gmail.com, Oct 6, 2005.

  1. Guest

    I created a "cancel" button for my form at the clients' request, I
    accidentally copied a submit button and added an OnClick event- a very
    simple javascript.history function. It did not appear to work at all-
    it kept submitting the form. I changed the submit button to a plain
    old button and it worked fine.

    Can anyone explain how the browser works with a javascript onClick
    event ona submit button? Does it automatically submit the form no
    matter what onClick event you use?

    Thanks,

    Don
     
    , Oct 6, 2005
    #1
    1. Advertising

  2. bjc Guest

    The onClick event allows you to program in some conditional program
    code; checking for errors etc. Ultimately it will submit the form.
     
    bjc, Oct 6, 2005
    #2
    1. Advertising

  3. Randy Webb Guest

    bjc said the following on 10/6/2005 10:41 AM:

    > The onClick event allows you to program in some conditional program
    > code; checking for errors etc. Ultimately it will submit the form.
    >


    It is easier to see what you are referring to if you quote what you are
    replying to.

    The submit button will ultimately submit the form as long as nothing
    stops it.

    --
    Randy
    comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
     
    Randy Webb, Oct 6, 2005
    #3
    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. Mr. SweatyFinger
    Replies:
    2
    Views:
    2,076
    Smokey Grindel
    Dec 2, 2006
  2. Guest
    Replies:
    2
    Views:
    1,630
    Guest
    Oct 25, 2004
  3. Replies:
    2
    Views:
    269
  4. jatrojoomla
    Replies:
    1
    Views:
    179
  5. Dr. Leff
    Replies:
    7
    Views:
    230
Loading...

Share This Page