<div class="codetitle"> <span><a style="CURSOR: pointer" data="90397" class="copybut" id="copybut90397" onclick="doCopy('code90397')"><u>Copy code</u></a></span> The code is as follows:</div> <div class="codebody" id="code90397"> <br> <head> <br> <title>JS limits Textarea text Number of field characters</title> <br> <meta http-equiv="Content-Type" content="text/html; charset=gb2312" /> <br> <SCRIPT LANGUAGE="JavaScript"> ; <BR> <!--// <BR> function textCounter(field, countfield, maxlimit) { <BR> // Function, 3 parameters, form name, form field element name, limit characters; <BR> if (field.value.length > maxlimit) <br> //If the number of characters in the element area is greater than the maximum number of characters, truncate it according to the maximum number of characters; <br> fieldfield.value = field.value.substring(0, maxlimit); <br> else <br> //Display the remaining number of characters in the count area text box; <br> countfield.value = maxlimit - field.value.length; <br> } <br> --> <br> </SCRIPT> " rows="5" onKeyDown="textCounter(message,remLen,6);" onKeyUp=<br>"textCounter(message,remLen,6);"></textarea> <br> You can also enter: <input name="remLen" type="text" value="6" size="5" readonly="readonly">Characters <br> </form> <br> </body> <br> </html><br><br> </div>