hi i have a textbox in html and i want a user to enter the numeric values only which will be for eg. 0,1,2,3,4,5,6,7,8,9,10 and if a user enters 11 it should show an alert box showing "only 0-10 is allowed" since i am a newbie so far i have this script
SCRIPT language=Javascript>
function validateForm()
{
var x=document.form["tst"]["num"].value;
var y = parseInt( x , 10 )
var i=15;
if (y>i)
{
alert("Range is Between 0-10");
return false;
}
}
</script>
here is my textbox code,
<INPUT id="num" name="num" onkeypress="return validateForm()" size="2" maxlength="2" type="text" >