博客
关于我
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 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 中更换画布背景颜色
查看>>
Python进阶03 模块
查看>>
python matplotlib简单使用
查看>>
Python mock Patch os.environ 和返回值
查看>>
Python mock 修补另一个函数调用的函数
查看>>
python mqtt 客户端实现
查看>>
Python Multiprocessing - 将类方法应用于对象列表
查看>>
Python multiprocessing.Queue 与 multiprocessing.manager().Queue()
查看>>
Python multiprocessing使用详解
查看>>
python mysql 基于 sqlalvhrmy_Python操作MySQL:pymysql和SQLAlchemy
查看>>
python mysql 布尔类型_python语言的基础学习:基本类型,函数,面向对象,模块,mysql数据库...
查看>>
Python NLP完整项目实战教程(1)
查看>>