Type = & quot; button & quot; and type = & quot; submit & quot;, buttonsubmit

Source: Internet
Author: User

Type = "button" and type = "submit", buttonsubmit
Type = "button", "submit)


Submit is a Button used to Submit a form. There are two main differences between Submit and Button:
Type = button is simply a button Function
Type = submit is the sending form
(1) Submit uses form submission (form. submit () as the default event after its onclick. This is not the case for a Button.
(2) When a form is submitted, all html input elements (including the input tag, button tag, and select tag) with the name attribute will be submitted as key-value pairs, except the Submit object. The Submit object is submitted as a key-Value Pair only after being clicked.
However, people engaged in web ui should note that using submit to improve the ease of use of pages:

After submit is used, the page supports the enter key operation. Many WEB software designers may not notice that the submit is unified.

After a button is used, the page usually does not support the enter key. Therefore, the enter key must be supported and a submit must be set. The default enter key is used to operate the first submit on the page.


After onClick is executed, go to action. OnClick is not required for automatic submission. So onclick can be avoided here.

After onClick is executed, the jump file is controlled in the js file. OnClick is required for submission.
For example:
1. onclick = "form1.action = 'a. jsp '; form1.submit ();" This enables the submit function.

To put it bluntly, the submit will have a jump, the page will be refreshed, and the button will not be refreshed, It is a button; you can use <button type = "submit/button/reset"> </button> to generate buttons, which are more flexible and better style control.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.