<html>
<head>
<title>只能输入数字和小数</title>
<script>
function onKeyUpDesc(text){
var value = text.value;
if (isNaN(value) && value != "." ){
value = value.substring(0,value.length-1);
text.value = value ;
}
}
</script>
</head>
<body>
<input type="text" oninput="onKeyUpDesc(this)" onpropertychange="onKeyUpDesc(this)">
</body>
</html>
可以输入多个点的(如IP地址,请关注下篇)