Prizes & Awards
My Profile
Active Members
TodayLast 7 Days
more...
|
The string Object
This article explains about JavaScript 'String 'object
<html>
<head>
<script>
function f()
{ v =document.getElementById('txt');
alert(v.value.length);
}
</script>
</head>
<body>
Enter Text and click on button to get lengh:<BR>
<input type ="text" id ="txt">
<input type ="button" value ="Click" onclick ="return f();" >
</body>
</HTML>
The output is self explanatory. It takes the input string and calculates the lengh.
The main purpose of length validation in real time is used in following cases.
To check length of password field, minimum as 7 characters maximum 25 To check Userid length id the length is not in the specified range and fire validation message To force user to enter in textboxes when it's a mandatory field or any other fields length checking
|
|