<html>
<head>
<script type="text/javascript">
function test(){
var obj = document.getElementById('test');
//alert(obj.value+":"+isNaN(obj.value));
if(!isNaN(obj.value)){
alert("您输入的是数字");
}else{
alert("您输入的不是数字");
}
}
</script>
</head>
<body>
<input type="text" id="test"
onpropertychange="if(/[^0-9\\-]/ig.test(value))value=value.replace(/[0-9^\\-]/ig,'')"
oninput="value=value.replace(/[^0-9\\-]/ig,'')"
style="ime-mode: disabled" ><input type="button" onclick="test()" value="验证"/>
</body>
</html>