Home > Web Front-end > JS Tutorial > javascript常见数据验证插件大全_javascript技巧

javascript常见数据验证插件大全_javascript技巧

WBOY
Release: 2016-05-16 15:47:40
Original
1207 people have browsed it

原生Javascript电话号码验证,邮件验证,身份证验证。使用时传入要验证的字符串,返回ture代表符合,返回false代码不符合。
使用:

document.getElementById("btnPhone").onclick=function(){
    alert(ValidationHandler.IsPhone(document.getElementById("phoneInput").value)==true?"合法":"不合法")
  };
  document.getElementById("btnEmail").onclick=function(){
    alert(ValidationHandler.IsEmail(document.getElementById("emailInput").value)==true?"合法":"不合法")
  };
  document.getElementById("btnIdCard").onclick=function(){
    alert(ValidationHandler.isIDCard(document.getElementById("idCardInput").value)==true?"合法":"不合法")
  };

Copy after login

以上介绍就是本文针对javascript常见数据验证插件大全的全部内容,希望对大家有所帮助。

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