Home
Developer Blog
Ajax effects
CSS examples
Freelance jobs
Hot IT Jobs
Hot scripts
Code samples
Web hosting directory
Lotus Notes FAQ
See the new scripts recently added to Dynamic Drive.
Click here
.
Original, practical
CSS codes and examples
such as CSS menus for your site.
Search code samples
Keyword
All Categories
ASP
CSS
Dhtml
Html
Javascript
PHP
Code Samples
ASP
CSS
Dhtml
Html
Javascript
PHP
LOGIN HERE
Username
Password
Signup Now
Forgot Password
Verify Signup
Javascript >> Events
how can i let users type only alphabet not numbers in a text field?
Visitor Ratings (2) :
Description
NN4 and IE5 allow to cancel key presses by returning false in the
onkeydown event handler.
Code
Select All
<SCRIPT> function validateNonNumber (evt) { var keyCode = evt.which ? evt.which : evt.keyCode; return keyCode < '0'.charCodeAt() || keyCode > '9'.charCodeAt(); } </SCRIPT> </HEAD> <BODY> <FORM NAME="aForm"> <INPUT TYPE="text" NAME="aField" ONKEYDOWN="return validateNonNumber(event)"> </FORM>
Rate this Resource
0
1
2
3
4
5
6
7
8
9
10