Astra
2005-08-11 11:51:59 UTC
Hi
I'm using the following routine on a text box to stop users from typing
anything but letters and numbers:
<SCRIPT LANGUAGE="javascript">
<!--
function CheckCodeEntry(e) {
var key = (navigator.appName == "Netscape") ? e.which : e.keyCode;
if (key == 8 || (key > 47 && key < 58) || (key > 64 && key < 91) || (key >
96 && key < 123)) {
return true;
}
else {
return false;
}
// 8 = backspace
// >47 to <58 = 0 to 9
// >64 to <91 = A to Z
// >96 to <123 = a to z
}
//-->
</SCRIPT>
My problem is that if somebody holds down the shift key and say 5 then % is
being entered, which I don't want. This happens for all shift key
functions.
Is there anyway round this?
Thanks
Robbie
I'm using the following routine on a text box to stop users from typing
anything but letters and numbers:
<SCRIPT LANGUAGE="javascript">
<!--
function CheckCodeEntry(e) {
var key = (navigator.appName == "Netscape") ? e.which : e.keyCode;
if (key == 8 || (key > 47 && key < 58) || (key > 64 && key < 91) || (key >
96 && key < 123)) {
return true;
}
else {
return false;
}
// 8 = backspace
// >47 to <58 = 0 to 9
// >64 to <91 = A to Z
// >96 to <123 = a to z
}
//-->
</SCRIPT>
My problem is that if somebody holds down the shift key and say 5 then % is
being entered, which I don't want. This happens for all shift key
functions.
Is there anyway round this?
Thanks
Robbie