JSP:在jsp页面怎么控制text的输入只能为数字?????

来源:百度知道 编辑:UC知道 时间:2024/06/04 18:47:05
rt

<input name="Price" value="" class="text" style="width:100px;" onkeyup="value=value.replace(/[^\d.]/g,'') "onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[^\d.]/g,''))" />

HTML页面都适合 只能输入数字和小数点。。。

检查一段字符串是否全由数字组成
<script language="Javascript">
<!--
function checkNum(str){return str.match(//D/)==null}
alert(checkNum("1232142141"))
alert(checkNum("123214214a1"))
// -->
</script>