<script>
function validate()
{
x=document.myForm
txt=x.myInput.value
if (txt>=1 && txt<=5)
{
alert("Thank you!")
return true
}
else
{
alert("Must be between 1 and 5")
return false
}
}
</script> |
<form
name="myForm" onsubmit="return
validate()">
Enter
a value from 1 to 5:
<input type="text" name="myInput">
<input
type="submit" value="Send input">
</form>
|