PDA

View Full Version : Looking for a script that cannot be less than 0 or more than 100?


ClueLess
03-15-2003, 06:28 PM
I am looking for the script that cannot let the user enter the # which less than 0 or more than 100. It must be between 0-100. If you know any where that I can find that script or you have that script......please let me know.....Thanks for your help.

Scke_Xival
03-15-2003, 06:42 PM
and do what with it?

x_goose_x
03-15-2003, 07:01 PM
<script>

last = "";
function check_keys(what) {
var char = what.value.charCodeAt(what.value.length-1);
var val = what.value
if ( 48 <= char && 57 >= char ) {
last = what.value;
} else if ( val == "" ) {
last = "";
} else {
what.value = last;
}
if ( 0 > val ) {
what.value = 0;
} else if ( 100 < val ) {
what.value = 100;
}
}

</script>

<body>

<form>
<input type="text" size="20" onkeyup="check_keys(this);">
</form>

ClueLess
03-15-2003, 07:29 PM
For age....

Thanks!!!