First: action is an attribute of form. HTML5 has defined it as a required attribute value. onSubmit is an event, and a function verification is performed when submitting through <input type="submit" />. . Second: As for the order of execution, my personal understanding is that onSubmit comes first, then verification. When the verification returns false, the action="url" address cannot be reached. If it returns true or no return value is given, it passes and redirects to the URL address. Copy code The code is as follows:function check(){ var oText = document.getElementById("in").value; alert(oText); if(oText == "false"){ return false; } else { return true;} }</span> Copy code The code is as follows:<span style="font-size:14px"> <form action="table1.html" onSubmit="return check();"> <div><input type="text" id="in" /><input type="submit" value="Submit" /></div> </form></span> onSubmit="return Fun();" The return here must be written, shouldn't it be written? You can try not to write! ! ! In short: onSubmit is for verification, and action is the link address after the jump. |
<<: JavaScript function detailed introduction
>>: How to build ssh service based on golang image in docker
XML Schema is an XML-based alternative to DTD. XM...
This article shares the specific code for impleme...
Previously, https://www.jb51.net/article/205922.h...
1. What are the formats of lines? You can see you...
Table of contents chmod Example Special attention...
Table of contents Preface The relationship betwee...
Vue3 project encapsulation side navigation text s...
This article records the installation and configu...
Achieve results The code is as follows html <t...
Preface Every time you use Docker to start a Hado...
Navigation bar creation: Technical requirements: ...
There is an interview question that requires: a th...
Table of contents 01 What is the essence of a con...
Table of contents Common functions of linux drive...
Related articles: Beginners learn some HTML tags ...