JavaScript Scripts





Español Français 中文 Deutsch Portuguese Japanese nederlands
   
 
Free Java Script Codes
Javascript List All
Slide Show Slide Show
Ad Display Ad Display
Image Effect Image Effect
Animated Image Effects Animated Image Effects
Form Validation Form Validation
Color Picker Tool Color Picker Tool
Formatting Forms Formatting Forms
Select All Select All
Dynamic Form Select Dynamic Form select
Dynamic Color Dynamic Color
Calendar Script Calendar
Textbox Counter Textbox Counter
Alphanumeric Alphanumeric
Date Time Script Date & Time
Stop Watch Script Stop Watch script
Delete Repeated Values Delete Repeated Values
Pagination Pagination
Random Generator Random Generator
Animated Text Animated Text
Cursor Position Cursor Position
User Info Window / User Info
Security Security / Authenticate
Bookmark Bookmark
Mouse Effects Mouse Effects
Title Bar Title Bar
Status Bar Status Bar
Country List Country List
Free Games Free Games
Calculators Calculators
 




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 to be 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 type="text/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 type="text/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 price

For customization of this script or any script development, contact us at support@hscripts.com


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 type="text/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
- The javascript (misspelled as java script) is given under GPL License
- i.e. Free use for those who use the codes as it is.
- Free, if your modification does not remove our copyright information and links.
- Click Here for detailed license information.
- You can purchase the script if your requirements does not meet our GPL License terms.
Other Links

web hosting