Button does not specify type as submit. Clicking the button does not jump to the specified URL.

Button does not specify type as submit. Clicking the button does not jump to the specified URL.
Today, due to project requirements, js is needed to control the submission of the form and verify and process the data before submitting.

The html code is as follows :

Copy code
The code is as follows:

<div class="test-ft">
<h3 class="shouji">Mobile phone number luck</h3>
<form needcheck="1" method="post" target="_blank" action="http://www.go108.com.cn/go108_mobile_free_sz.php">
<p>
...
</p>
<button class="btn-act">Test now</button>
</form>
</div>

After the coding was completed, a problem occurred during the browser compatibility test: clicking the button did not respond in IE6 and IE7, and the specified URL could not be jumped, but other browsers could jump normally.
I always thought there was a problem in the js control code, so I tracked and debugged it for a long time, but I still couldn't find the problem. Later, I found that the button did not specify type as submit, so I suspected that this was the problem.
After changing the type attribute of the added button to submit, the function works normally in IE6 and IE7.

I have never paid attention to such problems in the past and fell into a trap, so I went to search for information to verify.
w3shool has a detailed description of the button type attribute :
https://www.jb51.net/w3school/tags/att_button_type.htm

Copy code
The code is as follows:

Definition and Usage The type attribute specifies the type of button. Tip: Always specify a type attribute for buttons. The default type for Internet Explorer is "button", while the default in other browsers (including the W3C specification) is "submit". It can be seen that in other browsers, the form will be submitted after the button is clicked by default, while in IE, the form is not submitted after clicking by default. The default value of type is also a browser compatibility issue, so mark it.

<<:  Introduction to JavaScript conditional access attributes and arrow functions

>>:  A brief understanding of the relevant locks in MySQL

Recommend

Detailed explanation of node.js installation and HbuilderX configuration

npm installation tutorial: 1. Download the Node.j...

React entry-level detailed notes

Table of contents 1. Basic understanding of React...

How to use a field in one table to update a field in another table in MySQL

1. Modify 1 column update student s, city c set s...

Docker container orchestration implementation process analysis

In actual development or production environments,...

JavaScript to achieve the effect of tab bar switching

Tab bar: Click different tabs to display differen...

In-depth explanation of MySQL stored procedures (in, out, inout)

1. Introduction It has been supported since versi...

Example code for implementing a QR code scanning box with CSS

We usually have a scanning box when we open the c...

Using docker command does not require sudo

Because the docker daemon needs to bind to the ho...

Docker runs operations with specified memory

as follows: -m, --memory Memory limit, the format...

Axios secondary encapsulation example Demo in the project

1. Why do packaging? Facilitates overall code cal...

Analysis of mysql view functions and usage examples

This article uses examples to illustrate the func...

React+Antd implements an example of adding, deleting and modifying tables

Table of contents Table/index.js Table/model/inde...

CSS3 realizes various graphic effects of small arrows

It’s great to use CSS to realize various graphics...