Sirisha wrote on 17 nov 2006 in comp.lang.javascript
:
I have one textbox for enter telephone numbers.
i want that text box can accepts only 0 to 9 digits and one sapcace,
-,special characters.
I want Javascript script validation for that text box.
Never restrict textbox entry, as this confuses the user,
making a backspace on a typed in character that was rejected,
deleting another one than expected, etc.
Validation is ok, read up on regex.
testResult = !/[\d \-]/.test(tNr)
will test for "not 0123456789 -"
I cannot find a "sapcace" on my keyboard, btw ;-}
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)