faqts : Computers : Programming : Languages : JavaScript : Event handling

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

10 of 23 people (43%) answered Yes
Recently 5 of 10 people (50%) answered Yes

Entry

How is a form submit different from submit button onClick event?

May 15th, 2005 02:44
Seth Riedel, Naveen Sydney, http://sethworld.net


I'm not sure of the difference, but consider this:

For forms it is much bettter to use a normal button (not submit button)
with the onclick="action()" rather than using a submit button and onsubmit.

With javascript you can tell a form to be submitted with this code:

document.forms.formname.submit()

This is much more controllable than using onsubmit action.