码迷,mamicode.com
首页 > 移动开发 > 详细

手机号正则

时间:2017-09-04 16:01:38      阅读:127      评论:0      收藏:0      [点我收藏+]

标签:har   手机号码   utf-8   function   class   tle   正则   doc   enum   

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
</head>
<body>
<div class="input-choseNum">
<input type="number" id="phone" onblur="checkPhone()"/>
<span class="sureChoose">确定</span><span class="closeChoose">取消</span>
</div>
</body>
<script type="text/javascript">
function checkPhone(){
var phone = document.getElementById(‘phone‘).value;
if(!(/^1[34578]\d{9}$/.test(phone))){
alert("手机号码有误,请重填");
return false;
}
}
</script>
</html>

手机号正则

标签:har   手机号码   utf-8   function   class   tle   正则   doc   enum   

原文地址:http://www.cnblogs.com/nns4/p/7473728.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!