<!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>
时间: 2024-09-29 05:58:23