I'm trying to get a running count of characters in a textarea box for end
users to see how many characters they have left...I've been trying to use the
javascript code for this, as follows:
(in <HEAD> section)
< script="javascript >
function textCounter(field, countfield, maxlimit) {
if (field.value.length > maxlimit)
field.value = field.value.substring(0, maxlimit);
else
countfield.value = maxlimit - field.value.length;
}
</script>
(in <BODY> section)
<form method="post" >
(You may enter up to 250 characters.)<br>
<textarea name=message wrap=physical cols=50 rows=9
onKeyDown="textCounter(this.form.message,this.form.remLen,250);"
onKeyUp="textCounter(this.form.message,this.form.remLen,250);">
</textarea>
<br>
<input readonly type=text name=remLen size=3 maxlength=3 value="250"> 
characters left</font>
</form>
this is a common script out on the web, but for some reason, it will not
work at all, and it doesn't generate an error to indicate why...I get the
250 in the count box, but it stays constant...other javascripts seem to run
fine on the same page...
can anyone clue me in on this? does anyone have an alternative that will do
the same thing?
TIA..
ba
|