自动检测jsp页面提交的是不是数字

这个是我在网上找到的一个程序:

<input type="text" name="total" onKeyUp="value=value.replace(/[^\d.]/g,'')" onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[^\d.]/g,''))">文章源自堕落的鱼-https://www.duoluodeyu.com/48.html

将输入框的html代码,改成这个样子后每输入或粘贴一个字符就会进行检测如果不是数字则自动删除输入的字符,可以输入小数,即可以输入小数点。文章源自堕落的鱼-https://www.duoluodeyu.com/48.html 文章源自堕落的鱼-https://www.duoluodeyu.com/48.html

 最后更新:2011-5-13
匿名

发表评论

匿名网友
:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:
确定

拖动滑块以完成验证