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
WBOYOriginal
2016-05-16 16:39:411645browse

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.
Statement:
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