If it is for onkeydown event, then it should be:
return (event.keyCode>=65 && event.keyCode<=90 || event.keyCode==32);
to capture the actual keyboard key.
Quote:it functions well but i cannot erase?cannot use backspace :O
Then add one more condition to check for backspace key,
return (event.keyCode>=65 && event.keyCode<=90 || event.keyCode==32 || event.keyCode==8);
Quote:hey man another question i tested now to validate and allow only numbers and colon and backspace i try this codes onkeydown = "return (!(event.keyCode>=65 && event.keyCode!=32 || event.keyCode==186 || event.keyCode==8;" but it didnt work well for me ?
I have given you enough code and reference, It is up to you to straighten up your logic. If you want to accept numbers, what is the range of keycodes for numbers? If you do not want to accept space, why bother including it then checking that it is not? Watch the syntax too.