阿里云9.9元云服务器限时购买

2021年最新js手机号正则验证 最全全部号段

手机号验证正则

/^1[3-9]\d{9}$/

js的例子 isphone.html

<html>
<body>
<input id="Tel" type="text" value="18988889999">
<button onclick="myFunction()">验证号码</button>
<script>
function myFunction(){
  isPhone(document.getElementById("Tel").value);
}
function isPhone(phone) {
            var myreg=/^1[3-9]\d{9}$/;
            if (!myreg.test(phone)) {
                alert('no');
            } else {
                alert('yes');
            }
        }
</script>
</body>
</html>

 用自己私人的服务器来测试吧,99买阿里云

posted @ 2021-01-12 12:32  HIIT  阅读(10215)  评论(0编辑  收藏  举报
阿里云限时红包 最高 ¥ 2000 云产品通用红包,可叠加官网常规优惠使用