I have a problem.
When I click on button ok, it works
but how can I also make it work when I press the enter key??
is there a method like onEnter or something?
here is the code:
<html>
<HEAD>
<SCRIPT LANGUAGE=”JavaScript”>
function checkDecimals(fieldName, fieldValue) {
if (isNaN(fieldValue)) {
alert(“Oops! That does not appear to be a valid number. Please try again.”);
fieldName.select();
fieldName.focus();
}
if(fieldValue == “”) {
alert(“Oops! The input box is empty. Please try again.”);
fieldName.select();
fieldName.focus();
}
}
</script>
</HEAD>
<BODY>
<center>
<form action=”test.html” method=”post” >
Please enter a number with up to 2 decimal places: <br>
<input type=text name=”aantalbest”>
<input type=button name=ok value=”Ok” onClick=”return checkDecimals(this.form.aantalbest, this.form.aantalbest.value)” >
</form>
</center>
</body>
</html>