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

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

WBOY
WBOYOriginal
2016-05-16 15:47:401185browse

原生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?"合法":"不合法")
  };

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

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