
JavaScript Character Count
This script shows you how to add a character count to a form. It sets a max character limit of 200.
If you decide you want to use or alter the script to suit your needs, please give your support and leave a link to this site, thanks.
Try it out!
Example
Please note: The onkeyUp attribute of the TextArea tag is not supported in Netscape Navigator 6.0
Script Source
<form NAME="c_count">
<input type="text" name="count" value="200" size="3" onFocus="this.blur" readonly>
<br>
<textarea rows="5" cols="50" name="smsInput" wrap
onKeyUp="
val = this.value;
if (val.length > 200) {
alert('Sorry, the limit of 200 characters has been reached');
this.value = val.substring(0,200);
smsInput.focus()
}
this.form.count.value=200-parseInt(this.value.length);"></textarea>
</form>
Please let me know if this script was helpful to you.