mm*******@yahoo.co.uk said:
>
Hi
I'm pretty new to javascript and cross-browser stuff.
I want to restrict text input boxes to only numbers and decimal points
and exclude all else....except cursor keys, home keys etc.
Bad idea. As you've found, you can't be sure you've handled all
browsers correctly. You're likely to frustrate your users and
you gain nothing by it. Use an onChange event to audit the value
entered by the user to make sure it only contains valid characters.
Consider the person who sometimes hits the wrong key while typing,
but realizes it and hits the backspace, then the correct key, and
then continues typing (as I've managed to do three times in this
sentence). If you had blocked that incorrect key, their backspace
would have deleted the previous, correct, character, instead, and
they might not notice that. Input filtering causes input errors.
Or did you forget to allow backspace?
--