Tutorials » Javascript tutorials »

The string Object

This article explains about JavaScript 'String 'object




function f()

v =document.getElementById('txt');






Enter Text and click on button to get lengh:<BR>

<input type ="text" id ="txt">

<input type ="button" value ="Click" onclick ="return f();" >



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

  • Next Chapter: The Date Object
    Previous Chapter: The JavaScript String object
    More Chapters: Javascript Tutorials
    More Tutorials: Tutorial Index

    Top Contributors
    TodayLast 7 Daysmore...

    Awards & Gifts

    Online Members

    Ramesh Muthiah
    Copyright © SpiderWorks Technologies Pvt Ltd., Kochi, India