当前位置:网站首页>JS general form submission 1-onsubmit
JS general form submission 1-onsubmit
2022-07-03 13:54:00 【Cloud and cloud discoloration 1】
During form submission , If you directly click on the form submit Button will submit the form , But this method is not applicable when verification is needed .
Therefore, it usually happens in form In the statement of onsubmit Methods , Add fields to be verified in this method .
The method is as follows :
1、form Forms
<form id='form1' action='' method='' omsubmit='return checkForm()'>
<input type='text' name='username' value=''/>
<input type='password' name='pwd' value =''/>
<input type='password' name='pwd2' value =''/>
<button type='submit'> Submit <button/>
<form/>
2、 Statement onsubmit Method
<script>
function checkForm(){
var form = document.getElementById('form1');
// It can be modified here input
// Go to the next step
return true;
}
<script/>
3、 Submit Form
Triggered when the form is submitted checkForm, You can verify the password twice , You can also verify the validity of the user name , And if something goes wrong return fasle;, This will prevent the submission of the form .
It's just right onsubmit An attempt to , Then I will try to write general submit Method , And the use of ajax Method of submission , In this way, there is no way to refresh the submission form and ignore the form items to write the submission form .
above .
Refer to the connection :
https://www.cnblogs.com/web-wjg/p/7894657.html
边栏推荐
- Unity embeddedbrowser browser plug-in event communication
- AI scores 81 in high scores. Netizens: AI model can't avoid "internal examination"!
- IBEM 数学公式检测数据集
- SQL Injection (GET/Select)
- Richview trvstyle liststyle list style (bullet number)
- Complete deep neural network CNN training with tensorflow to complete picture recognition case 2
- Can newly graduated European college students get an offer from a major Internet company in the United States?
- Leetcode-1175.Prime Arrangements
- Windos creates Cordova prompt because running scripts is prohibited on this system
- Use docker to build sqli lab environment and upload labs environment, and the operation steps are provided with screenshots.
猜你喜欢

挡不住了,国产芯片再度突进,部分环节已进到4nm

TensorBoard可视化处理案例简析

Common network state detection and analysis tools

Use vscode to view hex or UTF-8 codes

CVPR 2022 | interpretation of 6 excellent papers selected by meituan technical team

PhpMyAdmin stage file contains analysis traceability

Use docker to build sqli lab environment and upload labs environment, and the operation steps are provided with screenshots.

掌握Cypress命令行选项,是真正掌握Cypress的基础
![Mysql:insert date:SQL 错误 [1292] [22001]: Data truncation: Incorrect date value:](/img/2f/33504391a661ecb63d42d75acf3a37.png)
Mysql:insert date:SQL 错误 [1292] [22001]: Data truncation: Incorrect date value:

Go language unit test 4: go language uses gomonkey to test functions or methods
随机推荐
Go language unit test 4: go language uses gomonkey to test functions or methods
Disruptor -- a high concurrency and high performance queue framework for processing tens of millions of levels
pytorch 载入历史模型时更换gpu卡号,map_location设置
Can newly graduated European college students get an offer from a major Internet company in the United States?
Go language unit test 5: go language uses go sqlmock and Gorm to do database query mock
Go: send the get request and parse the return JSON (go1.16.4)
PHP maze game
金属有机骨架MOFs装载非甾体类抗炎药物|ZIF-8包裹普鲁士蓝负载槲皮素(制备方法)
JVM系列——概述,程序计数器day1-1
使用Tensorflow进行完整的深度神经网络CNN训练完成图片识别案例2
Depth and breadth first traversal of tree (regardless of binary tree)
Qt学习22 布局管理器(一)
KEIL5出现中文字体乱码的解决方法
The reasons why there are so many programming languages in programming internal skills
Qt学习20 Qt 中的标准对话框(中)
树的深入和广度优先遍历(不考虑二叉树)
Go language web development series 29: Gin framework uses gin contrib / sessions library to manage sessions (based on cookies)
Qt学习23 布局管理器(二)
SQL Injection (POST/Search)
SQL Injection (GET/Search)