Look at the comments on this site, with a count down. II have done it like this before, and it is simple and effective. SOStack Overflow makes good use of color too.
Perhaps you don't have enough rep to see the comment box.
It runs a little countdown while you type. AtAt it approaches a threshold, the color changes from yellow to red. AllAll using javascriptJavaScript, and I assume the keyup event of the textarea.
EDIT: HowHow about having it done w/jquerywith jQuery?
<script language="javascript" type="text/javascript" src="js/jquery-1.2.6.min.js"></script> <script language="javascript" type="text/javascript"> $(document).ready( function () { setMaxLength(); $("textarea.checkMax").bind("click mouseover keyup change", function(){checkMaxLength(this.id); } ) }); function setMaxLength() { $("textarea.checkMax").each(function(i){ intMax = $(this).attr("maxlength"); $(this).after("<div><span id='"+this.id+"Counter'>"+intMax+"</span> remaining</div>"); }); } function checkMaxLength(strID){ intCount = $("#"+strID).val().length; intMax = $("#"+strID).attr("maxlength"); strID = "#"+strID+"Counter"; $(strID).text(parseInt(intMax) - parseInt(intCount)); if (intCount < (intMax * .8)) {$(strID).css("color", "#006600"); } //goodGood if (intCount > (intMax * .8)) { $(strID).css("color", "#FF9933"); } //warningWarning at 80% if (intCount > (intMax)) { $(strID).text(0).css("color", "#990000"); } //overOver } </script> And the HTML is
<textarea id="text" maxlength="250" class="checkMax"></textarea>