当前位置:网站首页>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
边栏推荐
- IBEM 数学公式检测数据集
- Qt学习23 布局管理器(二)
- Go 1.16.4: manage third-party libraries with Mod
- TensorBoard可视化处理案例简析
- Libuv Library - Design Overview (Chinese version)
- Another industry has been broken by Chinese chips. No wonder the leading analog chip companies in the United States have cut prices and sold off
- Conversion function and explicit
- Realize the recognition and training of CNN images, and process the cifar10 data set and other methods through the tensorflow framework
- Use docker to build sqli lab environment and upload labs environment, and the operation steps are provided with screenshots.
- Universal dividend source code, supports the dividend of any B on the BSC
猜你喜欢
![Mysql:insert date:sql error [1292] [22001]: data truncation: incorrect date value:](/img/2f/33504391a661ecb63d42d75acf3a37.png)
Mysql:insert date:sql error [1292] [22001]: data truncation: incorrect date value:

8 Queen question

Qt学习21 Qt 中的标准对话框(下)

全面发展数字经济主航道 和数集团积极推动UTONMOS数藏市场

Qt学习17 对话框及其类型
![[机缘参悟-37]:人感官系统的结构决定了人类是以自我为中心](/img/06/b71b505c7072d540955fda6da1dc1b.jpg)
[机缘参悟-37]:人感官系统的结构决定了人类是以自我为中心

Qt学习20 Qt 中的标准对话框(中)

The solution of Chinese font garbled code in keil5

3D vision - 2 Introduction to pose estimation - openpose includes installation, compilation and use (single frame, real-time video)
![[how to solve FAT32 when the computer is inserted into the U disk or the memory card display cannot be formatted]](/img/95/09552d33d2a834af4d304129714775.png)
[how to solve FAT32 when the computer is inserted into the U disk or the memory card display cannot be formatted]
随机推荐
Screenshot of the operation steps of upload labs level 4-level 9
Qt学习22 布局管理器(一)
Go language unit test 3: go language uses gocovey library to do unit test
Several common optimization methods matlab principle and depth analysis
Comprehensively develop the main channel of digital economy and digital group, and actively promote the utonmos digital Tibet market
GoLand 2021.2 configure go (go1.17.6)
Qt学习23 布局管理器(二)
There is nothing new under the sun. Can the meta universe go higher?
Go 1.16.4: manage third-party libraries with Mod
金属有机骨架(MOFs)抗肿瘤药载体|PCN-223装载甲硝唑|UiO-66包载盐酸环丙沙星([email protected])
HALCON联合C#检测表面缺陷——HALCON例程autobahn
JVM family - overview, program counter day1-1
Libuv Library - Design Overview (Chinese version)
The reasons why there are so many programming languages in programming internal skills
Using registered classes to realize specific type matching function template
C language standard IO function sorting
[技术发展-24]:现有物联网通信技术特点
Kivy tutorial how to automatically load kV files
Mobile phones and computers can be used, whole people, spoof code connections, "won't you Baidu for a while" teach you to use Baidu
【BW16 应用篇】安信可BW16模组与开发板更新固件烧录说明