日期:2014-05-17 浏览次数:20442 次
<div> <input id="phoneNo" type="text" onkeyup="checkPhoneNo(this);" /> <script type="text/javascript"> function checkPhoneNo(o) { var reg = /^0|[^\d]*/g; o.value = o.value.replace(reg, ''); } </script> </div>
------解决方案--------------------
<div> <input id="phoneNo" type="text" onkeyup="checkPhoneNo(this);" /> <script type="text/javascript"> function checkPhoneNo(o) { var reg = /^0[\d]+|[^\d]*/g; o.value = o.value.replace(reg, ''); } </script> </div>