Home  >  Article  >  Web Front-end  >  html表单验证证件类型和证件号码匹配,并验证问题_html/css_WEB-ITnose

html表单验证证件类型和证件号码匹配,并验证问题_html/css_WEB-ITnose

WBOY
WBOYOriginal
2016-06-24 12:01:151948browse

效果如图:


就是选择不同的证件类型,后面的输入框填写内容,需要验证。

因为不同证件类型的验证不一样。那么怎么实现好呢?


回复讨论(解决方案)

效果如图:


就是选择不同的证件类型,后面的输入框填写内容,需要验证。

因为不同证件类型的验证不一样。那么怎么实现好呢?


通过前面选择的验证方式选择对应验证规则,下面思路参考下
var reg = "";//正则表达式验证规则
if(身份证){
   reg = /身份证验证规则/;
}else if(学生证){
  reg = /学生证验证规则/;
}....

恩恩,非常感谢!

恩恩,非常感谢!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn