<html>
<head>
<script type="text/javascript">
txtValue="";
function checkNaN(obj)
{
if(isNaN(obj.value))
{
obj.value=txtValue;
}
else
{
txtValue=obj.value;
}
}
</script>
</head>
<body>
<form name="form1">
<input name="txt1" id="txt1" type="text" οnkeyup="checkNaN(this);"/>
</form>
</body>
</html>
让输入框只容许输入数字
最新推荐文章于 2024-04-27 20:05:30 发布