当前位置:网站首页>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
边栏推荐
- 【电脑插入U盘或者内存卡显示无法格式化FAT32如何解决】
- [技术发展-24]:现有物联网通信技术特点
- Use docker to build sqli lab environment and upload labs environment, and the operation steps are provided with screenshots.
- Implementation of Muduo asynchronous logging
- 金属有机骨架(MOFs)抗肿瘤药载体|PCN-223装载甲硝唑|UiO-66包载盐酸环丙沙星([email protected])
- 【556. 下一个更大元素 III】
- SQL Injection (AJAX/JSON/jQuery)
- 使用tensorflow进行完整的DNN深度神经网络CNN训练完成图片识别案例
- IBEM 数学公式检测数据集
- Unity embeddedbrowser browser plug-in event communication
猜你喜欢

Box layout of Kivy tutorial BoxLayout arranges sub items in vertical or horizontal boxes (tutorial includes source code)

解决MySql 1045 Access denied for user ‘root‘@‘localhost‘ (using password: YES)

There is nothing new under the sun. Can the meta universe go higher?

Complete deep neural network CNN training with tensorflow to complete picture recognition case 2

KEIL5出现中文字体乱码的解决方法

Unity embeddedbrowser browser plug-in event communication

RichView TRVStyle ListStyle 列表样式(项目符号编号)
![[quantitative trading] permanent portfolio, turtle trading rules reading, back testing and discussion](/img/3b/28327bbf5eb19254f03500a41e2adb.jpg)
[quantitative trading] permanent portfolio, turtle trading rules reading, back testing and discussion

MySQL 数据增删改查综合案例

从零开始的基于百度大脑EasyData的多人协同数据标注
随机推荐
使用Tensorflow进行完整的深度神经网络CNN训练完成图片识别案例2
How to use lxml to judge whether the website announcement is updated
Summary of common error reporting problems and positioning methods of thrift
Leetcode-1175. Prime Arrangements
Multi person collaborative data annotation based on Baidu brain easydata from scratch
SQL Injection (AJAX/JSON/jQuery)
ThreadPoolExecutor realizes multi-threaded concurrency and obtains the return value (elegant and concise way)
[556. Next larger element III]
JVM family - overview, program counter day1-1
Can newly graduated European college students get an offer from a major Internet company in the United States?
Bidirectional linked list (we only need to pay attention to insert and delete functions)
Ocean CMS vulnerability - search php
pytorch 载入历史模型时更换gpu卡号,map_location设置
The solution of Chinese font garbled code in keil5
Use docker to build sqli lab environment and upload labs environment, and the operation steps are provided with screenshots.
Brief analysis of tensorboard visual processing cases
[understanding by chance-37]: the structure of human sensory system determines that human beings are self-centered
Go 1.16.4: manage third-party libraries with Mod
Richview trvstyle liststyle list style (bullet number)
Using registered classes to realize specific type matching function template