Home > Web Front-end > HTML Tutorial > Introduction to action and onSubmit examples of Form forms_HTML/Xhtml_Web page production

Introduction to action and onSubmit examples of Form forms_HTML/Xhtml_Web page production

WBOY
Release: 2016-05-16 16:39:41
Original
1646 people have browsed it

First: action is an attribute of the form. HTML5 has defined it as a required attribute value. onSubmit is an event. A function verification is performed when submitting through . .

Second: When it comes to the order of execution, my personal understanding is that onSubmit comes first, and verification comes first. When verification returns false, the action="url" address cannot be reached. If true is returned or there is no return value, pass and redirect 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;}
}



Copy code
The code is as follows:





onSubmit="return Fun();" The return here must be written, isn't it? If you don’t write it, you can try it! ! !

In short: onSubmit is for verification, and action is the link address after the jump.
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template