霸道小豆丁 用javascript简单写的判断电话号码
1 手机号:<input type="text" class="loginuser" placeholder="请输入您的手机号" id="uid" onblur="checkPhone()" /> 2 <span id="uidt" style="margin-left: 100px"></span>
1 function checkPhone(){ 2 var phone = document.getElementById('uid').value; 3 if(!(/^1[34578]\d{9}$/.test(phone))){ 4 return document.getElementById('uidt').innerHTML = '请输入正确的手机号'; 5 return false; 6 } else{return document.getElementById('uidt').innerHTML = 'ok';} 7 }