Home > Web Front-end > JS Tutorial > body text

Example of simple form validation function implemented in JS

韦小宝
Release: 2018-01-12 09:57:47
Original
1612 people have browsed it

This article mainly introduces the simple form verification function implemented by JS, involving js's acquisition, judgment, focus setting and other related operation skills for form submission content. Friends who are interested in js can refer to the following This article

The example of this article describes the simple form validation function implemented by JS. Share it with everyone for your reference, the details are as follows:

Source code:





无标题文档



姓名:
年龄: 爱好:爬山 游泳 网球 乒乓球
密码:
重复密码:
备注:
Copy after login

myjs1.js file code:

// JavaScript Document
function checkit()
{ var flag = false;
 for(var i=0;i
Copy after login

Note: Use var to declare variables in js, Define functions Use function,

This example can realize the verification of hobbies (cannot be empty), and whether the passwords are consistent , and the length of the password must be greater than 8, and whether the remark is empty! In addition, the css file is left to the reader to beautify it~

Related recommendations:

Solution to the problem that Extjs uploaded images cannot be previewed Solution_extjs

The restrictions before JS uploading pictures include (jpg jpg gif and size height and width), etc.

JS preview before uploading Picture example

The above is the detailed content of Example of simple form validation function implemented in JS. 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
Popular Tutorials
More>
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!