博客
关于我
js根据不同证件进行校验
阅读量:178 次
发布时间:2019-02-28

本文共 1687 字,大约阅读时间需要 5 分钟。

Layui????????????????

?????????????????????????????????????????????Layui????????

???????????????????????????????????

??????Layui?????????????????????????

layui.use(['form','element'], function() {  var form = layui.form    , layer = layui.layer    , id_type; // ?????????  form.on('select(idsType)', function(data) {    id_type = data.value; // ???????????  });});

??????????????????????????????????????????

form.on('submit(demo1)', function(data) {  let idVal = $("input[name='idNumber']").val();  let reg;  if(id_type == 0) { // ???    reg = /(^\d{15}$)|(^\d{17}(\d|X|x))/;    if(!reg.test(idVal)){      layer.msg('??????', {time: 4000, icon:5});      return false;    }  } else if(id_type == 1) { // ???    reg = /^[a-zA-Z0-9]{7,21}$/;    if(!reg.test(idVal)){      layer.msg('??????', {time: 4000, icon:5});      return false;    }  } else if(id_type == 2) { // ??????/????    reg = /^[a-zA-Z0-9]{5,21}$/;    if(!reg.test(idVal)){      layer.msg('??????', {time: 4000, icon:5});      return false;    }  } else if(id_type == 3) { // ??????/????    reg = /^[a-zA-Z0-9]{5,21}$/;    if(!reg.test(idVal)){      layer.msg('??????', {time: 4000, icon:5});      return false;    }  } else if(id_type == 4) { // ???????    reg = /^[A-Z]{3}\d{6}(?:0[1-9]|1[021])(?:0[1-9]|[21]\d|3[10])\d{2}$/;    if(!reg.test(idVal)){      layer.msg('??????', {time: 4000, icon:5});      return false;    }  } else if(id_type == 5) { // ??    reg = /^[a-zA-Z0-9]{3,21}$/;    if(!reg.test(idVal)){      layer.msg('??????', {time: 4000, icon:5});      return false;    }  }});

????????????????????????????????????????????????Layui?????????????????????

转载地址:http://nwkj.baihongyu.com/

你可能感兴趣的文章
php json dom解析
查看>>
ReentrantReadWriteLock读写锁解析
查看>>
php laravel实现依赖注入原理(反射机制)
查看>>
php laravel请求处理管道(装饰者模式)
查看>>
ReentrantReadWriteLock读写锁底层实现、StampLock详解
查看>>
PHP mongoDB 操作
查看>>
ReentrantLock读写锁
查看>>
ReentrantLock的公平锁与非公平锁
查看>>
php mysql procedure获取多个结果集
查看>>
php mysql query 行数,PHP和MySQL:返回的行数
查看>>
php mysql session_php使用MySQL保存session会话
查看>>
PHP mysql_real_escape_string() 函数防SQL注入
查看>>
php mysql优化方法_MySQL优化常用方法
查看>>
PHP OAuth 2.0 Server
查看>>
php odbc驱动,php常用ODBC函数集(详细)
查看>>
php openssl aes ecb,php openssl_encrypt AES-128-ECB iOS
查看>>
php paypal rest api,PayPal REST API指定网络配置文件PHP
查看>>
php pcntl 多进程学习
查看>>
PHP pcntl_fork不能在web服务器中使用的变通方法
查看>>
php private ,public protected三者的区别
查看>>