表单 效验手机号

<form class="form" method="post" id="form" onsubmit="return checkForm(this)" action="">
电话号码:<input type="text" maxlength="11" name="tel"/>
<button type="submit" name="submit" value="提交"/>
</form>
<script>
function checkForm(o){    var re=/^(13[0-9]{9})|(15[89][0-9]{8})$/;   if(!re.test(o.tel.value)){      alert('请输入正确的手机号码。');      return false;   }}
</script>




猜你喜欢

转载自blog.csdn.net/hyt48079287/article/details/78461943
今日推荐