<html>
<head>
<script language='JavaScript'>
function checkKey(e) {
var key = e.which || e.keyCode; // NS vs. IE
// allow digits, decimal, tab, backspace, return
if (
( key != 8
&& key != 9
&& key != 13
&& key != 46
)
&& (key < 48 || key > 57)
) { return false; }
}
</script>
</head>
<body>
<h3>type a number (decimals OK)</h3>
<form>
<input type='text' size='3' maxlength='4' name='num' onKeyPress='return checkKey(event);' />
</form>
</body>
</html>
|