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
Table of contents Understanding Prototypes Unders...
In this article, I will explain the relevant cont...
Table of contents Preface Setting up with Vue CLI...
Table of contents Preface start A little thought ...
Method 1: Submit via the submit button <!DOCTY...
Table of contents About FastDFS 1. Search for ima...
Table of contents Loop - for Basic use of for loo...
This article shares the specific code for impleme...
Cleanly uninstall MySQL. Personally tested, this ...
answer from stackflow: Simply <br> is suffic...
Preface When operating and managing Linux servers...
This article describes various ways to implement ...
There are two ways to run .sh files in Linux syst...
This article summarizes some common MySQL optimiz...
Overview This article begins to introduce content...