让文本输入框只能输入数字
-------------------------------
onkeypress="if (event.keyCode < 45 || event.keyCode > 57) event.returnValue = false;"
-------------------------------
在文本框的 onkeypress事件中加入以上代码,屏蔽键盘事件中,输入值不是数字则返回为false
![](/Emoticons/QQ/23.gif)
![](/Emoticons/QQ/23.gif)
![](/Emoticons/QQ/23.gif)
![](/Emoticons/QQ/23.gif)
![](/Emoticons/QQ/23.gif)
![](/Emoticons/QQ/23.gif)
![](/Emoticons/QQ/23.gif)
![](/Emoticons/QQ/23.gif)
![](/Emoticons/QQ/23.gif)
![](/Emoticons/QQ/23.gif)
![](/Emoticons/QQ/23.gif)
![](/Emoticons/QQ/23.gif)
URL 正则 表达式:http(s)?://([\w-]+\.)+[\w-]+(/[\w- ./?%&=]*)?
onkeypress="if (event.keyCode < 45 || event.keyCode > 57) event.returnValue = false;"
-------------------------------
在文本框的 onkeypress事件中加入以上代码,屏蔽键盘事件中,输入值不是数字则返回为false
![](/Emoticons/QQ/23.gif)
![](/Emoticons/QQ/23.gif)
![](/Emoticons/QQ/23.gif)
![](/Emoticons/QQ/23.gif)
![](/Emoticons/QQ/23.gif)
![](/Emoticons/QQ/23.gif)
![](/Emoticons/QQ/23.gif)
![](/Emoticons/QQ/23.gif)
![](/Emoticons/QQ/23.gif)
![](/Emoticons/QQ/23.gif)
![](/Emoticons/QQ/23.gif)
![](/Emoticons/QQ/23.gif)
![](/Emoticons/QQ/23.gif)
URL 正则 表达式:http(s)?://([\w-]+\.)+[\w-]+(/[\w- ./?%&=]*)?