Meaningless Drivel is fun!*
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
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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: validation of a textbox value in javascript
 
Similar Threads
How to validate data in XML file is equal or not to the entered data
dont need negative values in textbox
Strange Problem with netscape
why is this JS validation function failing?
textbox validation in javascript