Does any one have any ideas on how to fix the code so that the number of remaining characters is carried through and additions or deletions made in the edit form are reflected?
Code: Select all
function 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' counter
else
countfield.value = maxlimit - field.value.length;
}
<textarea id="message" name="message" wrap="hard" cols=70
rows=10 width="120" onKeyDown="textCounter(this.form.message,this.form.remLen,480);"
onKeyUp="textCounter(this.form.message,this.form.remLen,480);"><?php print (htmlspecialchars(ltrim(stripslashes($message)))) ?></textarea>
<br><br>
You have <input readonly type=text name=remLen size=3 maxlength=3
value="480"> characters left