phermis

营业执照注册码 需要验证长度为15 16 18位的纯数字

(1)html部分

<div class="test3 txt-com">
     <input id="StoreAddTxt4" type="text" name="txt3Name" onblur="onlyNum1(this)"/>
     <i style="font-size: 16px;color: red;">提示例子:营业执照号码 校验15 16 18 位纯数字 </i>
     <div id="Prompt4" class="txt-com hint"><i>请输入正确的营业执照号码!</i></div>
</div>

(2)js部分

    /*营业执照号码 onlyNum1*/
    function onlyNum1(num){
        var reg = /^\d+$/;
        var num_val = $(num).val();
        if(reg.test(num_val)){
            var len = num_val.length;
            if(len==15 || len==16 || len==18){
                $("#Prompt4").children().css("visibility", "hidden");
                $("#Prompt4").children().text("营业执照号码错误!");
                num = true;
            }else{
                $("#Prompt4").children().css("visibility", "visible");
                $("#Prompt4").children().text("请输入正确的营业执照号码!");
                num = false;
            }
        }else{
            $("#Prompt4").children().css("visibility", "visible");
            $("#Prompt4").children().text("请输入正确的营业执照号码!");
            num = false;
        }
    }

 

分类:

技术点:

相关文章:

  • 2021-12-12
  • 2021-11-30
  • 2022-12-23
  • 2022-01-18
  • 2022-12-23
  • 2021-03-31
  • 2021-12-23
猜你喜欢
  • 2021-12-12
  • 2021-07-18
  • 2021-12-25
  • 2021-12-12
  • 2021-07-25
  • 2021-05-21
  • 2021-08-11
相关资源
相似解决方案