Differences between js form submission and submit submission

Source: Internet
Author: User
This article introduces the differences between js form submission and submit submission.
 Untitled documentScript function test () {document. getElementById ("myform"). submit (); alert (11);} script

Note: When the get method is used to submit a form, values cannot be passed through the url in the action, and values can be passed through the post method in this way.


Differences between js submission and submit button submission:

1. When submitting a form in js, the value of the submit button is not included (because it is not clicked) in all browsers.

2. input and press enter to submit the w3c browser. The value of the submit button is not included in ie6.

Solution: Add a hidden domain and use this to determine whether or not to submit the data.


Bind a submission event on the submit button:

That is:

Will carry the value of submit, and the onsubmit status cannot be detected when submitting with js.

W3c: submit once

Ie6: submitted twice. js submitted in form first

Solution: If the button is submit, the onsubmit event is used for detection.

If the button is a button, the submit event is triggered after the detection succeeds.

Do not use js to submit the form, and then use onsubmit to detect


Simply use js to submit a form. alert and ff will block the submission of the form.


For details about the differences between js form submission and submit submission, refer to the PHP Chinese website!

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.