x,y and z (word) – find the “word” specified in the round brackets [abc|xyz] – find either the characters a,b,c or x,y,z We’ll start first with validating a textbox that accepts only numbers.
So the condition is we check whether the textbox contains anything ELSE other than numbers and display a message As you can see the function validate() checks if the entered string contains characters that does NOT (notice the ^ symbol) match the numbers 0 to 9 including white spaces and special characters.
IE doesn't enable scripting on local web pages until you choose to enable it from the yellow info bar.
See for an example: It seems to work on the test code that I created from your post, so assuming that your test code is the same, there must be something else causing the problem. Commonly the most effective way is for you to link to a test page that you have on the internet, or failing that, you can attach a file to a post. The script will only run when scripting is actually enabled.
A decent start, but a) although it warns users if they hit an icorrect key, the character is still entered into the textbox, so could still be submitted; b) users can still paste illegal characters in, and this code will not pick up on this.