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

你可能感兴趣的文章
POJ--2391--Ombrophobic Bovines【分割点+Floyd+Dinic优化+二分法答案】最大网络流量
查看>>
Qt笔记——SQLite初探QSqlDatabase QSqlQuery
查看>>
POJ-1163-The Triangle
查看>>
POJ-Fence Repair 哈夫曼树
查看>>
poj1061 - 同余方程,二元一次不定方程
查看>>
Qt笔记——SQLite再探
查看>>
poj1068Parencodings
查看>>
poj1182(带权并查集)
查看>>
POJ1182(带权并查集)
查看>>
Qt笔记——Qt初探、PyQt5和Qt5
查看>>
poj1190生日蛋糕
查看>>
POJ1218 HDU1337 ZOJ1350 UVALive2557 THE DRUNK JAILER
查看>>
poj1222 EXTENDED LIGHTS OUT(gauss)
查看>>
POJ1240 m叉树
查看>>
Poj1328--Radar Installation(区间选点)
查看>>
POJ1384Piggy-Bank(DP)
查看>>
POJ1417 True Liars —— 并查集 + DP
查看>>
Poj1459 Power Network 预流推进
查看>>
POJ1502(MPI Maelstrom)
查看>>
poj1568 Find the Winning Move[极大极小搜索+alpha-beta剪枝]
查看>>