H I O X INDIA
FREE Javascript
 HOME  ||  Scripts  ||  Purchase  ||  Tutorials  ||  Images  ||  Tools  ||  Directories 
  :-)  Send Page   :-)   Feedback   :-)   Register   :-)   Links   :-)   Support   :-)   Bookmarks :-)  
 Forums   Hosting   Internet Stats   Easy Calculation   FUN Games 

Java Script Source
List All
Date & Time
Calendar
Stop Watch script
Slide Show
Image Effect
Mouse Effects
Color Picker Tool
Dynamic Color
Random Generator
Select All
Form Validation
Textbox Counter
Dynamic Form select
Bookmark
Window / User Info
Security / Authenticate
Status Bar
Title Bar
Cursor Position
Country List
Calculators
Delete Repeated Values
Alphanumeric
Free Games





Character Counter/Limiter Java Script


About
This javascript function will help you to limit/count the size of characters entered/typed in text area or in text box.


Features
a)You can limit the number of characters tobe entered/typed in text area/textbox.
b)This javascript displays number of characters left to type in textbox.
c)Easy to specify the size/length of character counter/limiter.
d)Just copy the code in to your page and use it.
e)Simple and ease of use.


Preview for Character Counter

Type your data in Textarea / Textbox:
Character left:


Code
  Javascript Code
<!-- Script by hscripts.com -->
<script language=javascript>
//Edit the counter/limiter value as your wish
var count = "125";   //Example: var count = "175";
function limiter(){
var tex = document.myform.comment.value;
var len = tex.length;
if(len > count){
        tex = tex.substring(0,count);
        document.myform.comment.value =tex;
        return false;
}
document.myform.limit.value = count-len;
}

</script>
<!-- Script by hscripts.com -->

  HTML Code
<!-- Script by hscripts.com -->
<form name="myform" METHOD=POST>
<textarea name=comment wrap=physical rows=3 cols=40 onkeyup=limiter()></textarea><br>
<script language=javascript>
document.write("<input type=text name=limit size=4 readonly value="+count+">");
</script>
</form>
<!-- Script by hscripts.com -->
Release Date - 19-07-2007

Get free version without ©copyright link for just 5



Usage
Here we have explained How to use the count character javascript with the help of a form. The count value decreases when you type each character into textbox.
  1. Copy the javascript code into the head part of your HTML page.
  2. Copy the HTML code, This will create a textarea to enter the words/characters,Also a form field will be created which counts the character.
    <form name="myform" METHOD=POST>
    <textarea name=comment wrap=physical rows=3 cols=40 onkeyup=limiter()></textarea><br>
    <script language=javascript>
    document.write("<input type=text name=limit size=4 readonly value="+count+">");
    </script></form>


  3. d)You can easily set the limit or counter as your wish. If you wish to restrict the user not to type more than 250 characters in text area/textbox change the count value as 250. This will set the length or size of text area or text box.
     Example:var count = "250";
  4. The java script function "limiter()" will limit the size or length of characters typed in textarea or text box.




License
- This javascript (misspelled as java script)/HTML code is given under GPL License
- i.e. Free use for those who use it as it is.
- Free, if your modification does not remove our copyright information and links.
- Detailed License information can be found here
- You can purchase the script if your requirements does not meet GPL License terms.


privacy policy     license     sitemap
© 2004-2005 HIOX INDIA - hioxindia.com

Others