html and distinguish submit button is!

html in both the submit button and have demonstrated in the form of a button, the button looks are, the difference is on the event type and properties of the hair response, submit to submit the form, button does not submit the form.
both the submit button and the main difference is that:
1, submit the default form is submitted, you can submit the form (form). submit button is actually a special case, but also a button, which is to submit the action automatically integrated.
2, button as a normal button in response to the user-defined event, such as if the onclick event handler is not specified, it does not do anything, do not submit the form data automatically. Of course, button can also JS code completion form submission. For example: onclick = "document.form1.submit ()" .
3, if the form needs to be processed (including input validation) and then submit, then use JS after clicking the submit button, usually must submit change button, cancels its auto-commit behavior, otherwise, it will cause twice submitted effect, for dynamic web pages , it is twice database operations. When in use, or submit validation plus return true or false.

Reference links:

https://blog.csdn.net/aiming66/article/details/79046432

Guess you like

Origin www.cnblogs.com/DarryZz04/p/11105971.html