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:
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!