Hi,
This is really stumping me? I have a form that calls a Javascript function and uses event keycode numbers to restrict people from inputting letters, therefore eliminating the need for form validation. However it is still allowing these characters (but it shouldn't):
!#$%&*()+-':",./
I want the users to only input numbers 0-9 and the decimal button.
Here is my code:
<HTML>
<HEAD>
<TITLE>CALCULATOR</TITLE>
<SCRIPT LANGUAGE="Javascript">
function noLet()
{
if (event.keycode < 47 || event.keyCode > 58) event.returnValue = false;
}
</SCRIPT>
</HEAD>
<BODY>
<FORM>
<INPUT TYPE="NUMBER" SIZE="10" NAME="a" onKeypress="noLet()" class="colors2">
</FORM>
</BODY>
</HTML>
Can someone help me, so that only numbers 0-9 and decimal are used and nothing else.
Thanks!
"Quest for the Cup - 2002!"
"Onto the 2[sup]nd[/sup] round!"
This is really stumping me? I have a form that calls a Javascript function and uses event keycode numbers to restrict people from inputting letters, therefore eliminating the need for form validation. However it is still allowing these characters (but it shouldn't):
!#$%&*()+-':",./
I want the users to only input numbers 0-9 and the decimal button.
Here is my code:
<HTML>
<HEAD>
<TITLE>CALCULATOR</TITLE>
<SCRIPT LANGUAGE="Javascript">
function noLet()
{
if (event.keycode < 47 || event.keyCode > 58) event.returnValue = false;
}
</SCRIPT>
</HEAD>
<BODY>
<FORM>
<INPUT TYPE="NUMBER" SIZE="10" NAME="a" onKeypress="noLet()" class="colors2">
</FORM>
</BODY>
</HTML>
Can someone help me, so that only numbers 0-9 and decimal are used and nothing else.
Thanks!
"Quest for the Cup - 2002!"
"Onto the 2[sup]nd[/sup] round!"