html input验证只能输入数字,不能输入其他
此方法为借鉴别人的,在此只做记录。
<input type="text" onkeyup="if(!/^\d+$/.test(this.value)) tip.innerHTML=‘必须输入数字,且不能有空格。‘; else tip.innerHTML=‘‘;" /><span id="tip"></span>
<input type=
"text"
onkeyup=
"if(!/^\d+$/.test(this.value)) tip.innerHTML=‘必须输入数字,且不能有空格。‘; else tip.innerHTML=‘‘;"
/><span id=
"tip"
></span>
原文:http://www.cnblogs.com/dongteng/p/7211593.html