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 PHP+nginx service 500 502 error troubleshooting ideas

Overview When a 500 or 502 error occurs during ac...

7 interesting ways to achieve hidden elements in CSS

Preface The similarities and differences between ...

Mini Program to Implement Calculator Function

This article example shares the specific code of ...

Negative distance (empathy) - iterative process of mutual influence

Negative distance refers to empathy. Preface (rai...

Summary of js execution context and scope

Table of contents Preface text 1. Concepts relate...

Five ways to implement inheritance in js

Borrowing Constructors The basic idea of ​​this t...

Vue+webrtc (Tencent Cloud) practice of implementing live broadcast function

Table of contents 1. Live broadcast effect 2. Ste...

Detailed explanation of root directory settings in nginx.conf

There are always some problems when configuring n...

Specific use of CSS content attribute

The content attribute is generally used in the ::...

A brief talk about MySQL pivot tables

I have a product parts table like this: part part...

Some tips on speeding up the development of WeChat mini-programs

1. Create a page using app.json According to our ...