Full version: jsB@nk » Utility » Counter-Limitation » Limit Textarea
URL: https://www.javascriptbank.com/limit-textarea.html
This JavaScript controls a maximum textarea input amount and updates a small counter with how many characters are left with each keystroke. Dynamic fix now allows you to use this JavaScript in multiple textboxes on a page. Easy!
Full version: jsB@nk » Utility » Counter-Limitation » Limit Textarea
URL: https://www.javascriptbank.com/limit-textarea.html
<SCRIPT LANGUAGE="JavaScript"><!-- Original: Ronnie T. Moore --><!-- Dynamic 'fix' by: Nannette Thacker --><!-- Beginfunction textCounter(field, countfield, maxlimit) {if (field.value.length > maxlimit) // if too long...trim it!field.value = field.value.substring(0, maxlimit);// otherwise, update 'characters left' counterelse countfield.value = maxlimit - field.value.length;}// End --></script><!-- This script downloaded from www.JavaScriptBank.com Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->
<form name=myform action="YOUR-SCRIPT.CGI"><font size="1" face="arial, helvetica, sans-serif"> ( You may enter up to 125 characters. )<br><textarea name=message wrap=physical cols=28 rows=4 onKeyDown="textCounter(this.form.message,this.form.remLen,125);" onKeyUp="textCounter(this.form.message,this.form.remLen,125);"></textarea><br><input readonly type=text name=remLen size=3 maxlength=3 value="125"> characters left</font></form><!-- This script downloaded from www.JavaScriptBank.com Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->