This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes HTML, CSS and JavaScript and the fly likes validation of a textbox value in javascript Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "validation of a textbox value in javascript" Watch "validation of a textbox value in javascript" New topic
Author

validation of a textbox value in javascript

Yell Srik
Ranch Hand

Joined: Mar 10, 2004
Posts: 61
The following is the code i am using to validate the entries into a textbox:




In the above code, if any value other that 0 to 9 is entered, alert is thrown.

Now i want this code to be modified such that only 1 or 2 digit number should be valid ie if i enter 111 or 2345, it should throw the alert message.

How can i acheive this??


Thanks in advance
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14687
    
  16

Check form.regno.value.length


[My Blog]
All roads lead to JavaRanch
 
Don't get me started about those stupid light bulbs.
 
subject: validation of a textbox value in javascript
 
Similar Threads
textbox validation in javascript
dont need negative values in textbox
why is this JS validation function failing?
Strange Problem with netscape
How to validate data in XML file is equal or not to the entered data