<SCRIPT LANGUAGE="JavaScript">
// function parameters are: field - the string field, count - the field for remaining characters number and max - the maximum number of characters
function CountLeft(field, count, max) {
// if the length of the string in the input field is greater than the max value, trim it
/*if (field.value.length >= max)
field.value = field.value.substring(0, max);
else
// calculate the remaining characters
*/
/*
if (field.value.length >= max)
count.value = 0;
else
count.value = max - field.value.length;
*/
count.value = field.value.length;
}
</script>
</p>
<p><font size="1" face="arial, helvetica, sans-serif">
<textarea name="txtDescription" cols="30" rows="10" onKeyDown="CountLeft(this.form.txtDescription,this.form.left,50);" onKeyUp="CountLeft(this.form.txtDescription,this.form.left,50);" id="txtDescription"></textarea>
<br>
<input readonly type="text" name="left" size=10 maxlength=3 value="50">
จำนวนตัวอักษร
</font><br>
<br>
</p>