Example sharing of JavaScript implementation of registration page form verification

黄舟
Release: 2017-08-20 10:03:19
Original
2457 people have browsed it

The following editor will bring you an example of using JavaScript to complete the form verification on the registration page. The editor thinks it’s pretty good, so I’ll share it with you now and give it as a reference. Let’s follow the editor and take a look

1. Step analysis

The first step: Determine the event (onsubmit) and provide It binds a function

Step 2: Write this function (get the data input by the user )

Step 3: To the user Judge the entered data

Step 4: The data is legal (allow the form to be submitted)

Step 5: The data is illegal (give an error message and do not allow the form to be submitted)

Question: How to control form submission?

About the event onsubmit: Generally used for form submission, then a return value needs to be given when defining the function.

onsubmit = return checkForm()

2. Complete the registration page form verification


    注册页面  
登录 注册 购物车
首页 手机数码 电脑办公 鞋靴箱包 家用电器
会员注册 USER REGISTER
用户名
密码
确认密码
E-mail
姓名
性别
出生日期
验证码
关于我们 联系我们 招贤纳士 法律声明 友情链接 支付方式 配送方式 服务声明 广告声明

Copyright © 2005-2016 hh商城 版权所有

Copy after login

Use regular expressions in the verification and confirmation part of the password (no need to remember, look for documents when needed)

Regular expression.test (verification object) is true if it meets the conditions, if it is false, it is incompatible.

The above is the detailed content of Example sharing of JavaScript implementation of registration page form verification. For more information, please follow other related articles on the PHP Chinese website!

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
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!