aspose file tools*
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 Spring in Action this week in the Spring 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: 14688
    
  16

Check form.regno.value.length


[My Blog]
All roads lead to JavaRanch
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: validation of a textbox value in javascript