JAVASCRIPT The legality code of the client verification data is relatively complete, so it is simply paginated and friends who like it can save it.
Copy code The code is as follows:
javascript verification Complete list of forms
1. Length limit
Copy code The code is as follows:
<script> <br>function test() <br>{ <br>if(document.a.b.value.length>50) <br>{ <br>alert("Cannot exceed 50 characters!"); <br>document.a.b.focus(); <br>return false; <br>} <br>} <br></script>
2. Can only be Chinese characters
3." It can only be in English
Copy code The code is as follows:
7. Block keywords (*** and **** are blocked here)
Copy code The code is as follows:
8. Check whether the password entered twice is the same
Copy the code The code is as follows:
That's enough :)
It's cool to block the right click
oncontextmenu="return false" ondragstart="return false" onselectstart="return false"
Add to body
2
2.1 Form items cannot be empty
Copy code The code is as follows:
2.2 Compare whether the values of two form items are the same
Copy code The code is as follows:
2.3 Form items can only be numbers and "_", which are used for phone/bank account verification and can be extended to domain name registration, etc.
Copy code The code is as follows:
2.4 Form item input value/length limit
Copy code The code is as follows:
2.5 Chinese/English/Number/ Determining the validity of email addresses
Copy code The code is as follows:
2.6 限定表单项不能输入的字符
复制代码 代码如下:
1. 检查一段字符串是否全由数字组成
---------------------------------------
2. 怎么判断是否是字符
---------------------------------------
if (/[^x00-xff]/g.test(s)) alert("含有汉字");
else alert("全是字符");
3. 怎么判断是否含有汉字
---------------------------------------
if (escape(str).indexOf("%u")!=-1) alert("含有汉字");
else alert("全是字符");
当前1/2页 12下一页阅读全文