zhujiabin

 验证130-139,150-159,180-189号码段的手机号码

<script type="text/javascript">
var myreg = /^(((13[0-9]{1})|(15[0-9]{1})|(18[0-9]{1}))+\d{8})$/; 
if(!myreg.test($("#phone").val())) 
{ 
    alert(\'请输入有效的手机号码!\'); 
    return false; 
} 
</script>

以上代码是在jquery下调试的。不需要jquery的代码

function validatemobile(mobile) 
   { 
       if(mobile.length==0) 
       { 
          alert(\'请输入手机号码!\'); 
          document.form1.mobile.focus(); 
          return false; 
       }     
       if(mobile.length!=11) 
       { 
           alert(\'请输入有效的手机号码!\'); 
           document.form1.mobile.focus(); 
           return false; 
       } 
        
       var myreg = /^(((13[0-9]{1})|(15[0-9]{1})|(18[0-9]{1}))+\d{8})$/; 
       if(!myreg.test(mobile)) 
       { 
           alert(\'请输入有效的手机号码!\'); 
           document.form1.mobile.focus(); 
           return false; 
       } 
   } 

 

分类:

技术点:

相关文章:

  • 2021-12-30
  • 2022-02-03
  • 2022-01-11
  • 2021-11-27
  • 2021-12-31
  • 2022-02-01
猜你喜欢
  • 2021-12-01
  • 2021-12-23
  • 2022-12-23
  • 2022-02-04
  • 2022-12-23
  • 2022-01-02
相关资源
相似解决方案