Hi
I'm having trouble cancelling an OnKeyPress event from a function (e.g. when and invalid key is pressed). the event is on an INPUT of type Text.
i've followed a few examples in these archives, but one that appears to be someone elses solution doesn't work for toffee on my machine!
Here is what my code snippit looks like...
------------
<SCRIPT LANGUAGE="JavaScript">
<!--
function validate(event)
{
if (event.keyCode < 48 | event.keyCode > 57)
return false;
}
// -->
</SCRIPT>
ENTER INTEGER:
<input type="text" name="NewCode" onkeypress="validate(event)"></input>
------------------------------
any ideas? (I am using IE5 and do not require NS compatibility).
go on, tell me there's a glaring error - PLEASE!
Thanks
Julian
I'm having trouble cancelling an OnKeyPress event from a function (e.g. when and invalid key is pressed). the event is on an INPUT of type Text.
i've followed a few examples in these archives, but one that appears to be someone elses solution doesn't work for toffee on my machine!
Here is what my code snippit looks like...
------------
<SCRIPT LANGUAGE="JavaScript">
<!--
function validate(event)
{
if (event.keyCode < 48 | event.keyCode > 57)
return false;
}
// -->
</SCRIPT>
ENTER INTEGER:
<input type="text" name="NewCode" onkeypress="validate(event)"></input>
------------------------------
any ideas? (I am using IE5 and do not require NS compatibility).
go on, tell me there's a glaring error - PLEASE!
Thanks
Julian