博客
关于我
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/

你可能感兴趣的文章
STM32工作笔记0032---编写跑马灯实验---寄存器版本
查看>>
Static--用法介绍
查看>>
ssm旅游信息管理系统的设计与实现bus56(程序+开题)
查看>>
order by rand()
查看>>
SSM(Spring+SpringMvc+Mybatis)整合开发笔记
查看>>
ViewHolder的改进写法
查看>>
Orderer节点启动报错解决方案:Not bootstrapping because of 3 existing channels
查看>>
org.apache.axis2.AxisFault: org.apache.axis2.databinding.ADBException: Unexpected subelement profile
查看>>
sql查询中 查询字段数据类型 int 与 String 出现问题
查看>>
org.apache.commons.beanutils.BasicDynaBean cannot be cast to ...
查看>>
org.apache.dubbo.common.serialize.SerializationException: com.alibaba.fastjson2.JSONException: not s
查看>>
sqlserver学习笔记(三)—— 为数据库添加新的用户
查看>>
org.apache.http.conn.HttpHostConnectException: Connection to refused
查看>>
org.apache.ibatis.binding.BindingException: Invalid bound statement错误一例
查看>>
org.apache.ibatis.exceptions.PersistenceException:
查看>>
org.apache.ibatis.exceptions.TooManyResultsException: Expected one result (or null) to be returned
查看>>
org.apache.ibatis.type.TypeException: Could not resolve type alias 'xxxx'异常
查看>>
org.apache.poi.hssf.util.Region
查看>>
org.apache.xmlbeans.XmlOptions.setEntityExpansionLimit(I)Lorg/apache/xmlbeans/XmlOptions;
查看>>
org.apache.zookeeper.KeeperException$ConnectionLossException: KeeperErrorCode = ConnectionLoss for /
查看>>