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

你可能感兴趣的文章
Python Kivy ListView:如何删除选定的 ListItemButton?
查看>>
Python kivy 入口点 inflateRest2 无法定位 libpng16-16.dll
查看>>
Python Kivy库:跨平台应用开发
查看>>
python lambda表达式
查看>>
Python ldap3 代码从 SID 获取用户名
查看>>
Python list += iterable 的行为是否记录在任何地方?
查看>>
python list,str的拼接与转换
查看>>
python list函数使用总结_史上最全的Python数据结构:列表和元组用法总结
查看>>
python locust 性能测试:locust参数-保证并发测试数据唯一性,循环取数据
查看>>
python locust 性能测试:locust安装和一些参数介绍
查看>>
python log
查看>>
python logging basicconfig_python之logging.basicConfig
查看>>
Python logging模块使用
查看>>
python logging模块学习
查看>>
python mac地址_python中MAC地址打包问题
查看>>
python manage.py syncdb Unknown command: 'syncdb'问题解决方法
查看>>
Python map() 函数 和 numpy mean()函数
查看>>
Python Matplotlib Box并排绘制两个数据集
查看>>
Python Matplotlib 中如何用 plt.savefig 存储图片
查看>>
Python matplotlib 中更换画布背景颜色
查看>>