组织机构代码证号码校验

(1)html部分

<div class="test4 txt-com">
     <input id="StoreAddTxt17" name="txt13Name"  type="text" onblur="onlyCardNum3(this)" />
     <i style="font-size: 16px;color: red;">提示例子:88888888-1  </i>
     <div id="Prompt17" class="txt-com hint"><i>请输入正确的组织机构代码证号码!</i></div>
</div>

(2)js部分

    /*组织机构代码证号码onlyCardNum3*/
    function onlyCardNum3(num){
        var reg = /^\d{8}-?\d{1}$/;
        var num_val = $(num).val();
        if(reg.test(num_val)){
            $("#Prompt17").children().css("visibility", "hidden");
            $("#Prompt17").children().text("组织机构代码证号码错误!");
            num = true;
        }else{
            $("#Prompt17").children().css("visibility", "visible");
            $("#Prompt17").children().text("请输入正确的组织机构代码证号码!");
            num = false;
        }
    }

 

posted @ 2017-04-18 14:28  三高娘子  阅读(1483)  评论(0编辑  收藏  举报