function textCounter(field, countfield, maxlimit){
if (field.value.length > maxlimit){
if( field.value.indexOf("
") == maxlimit-1){
field.value = field.value.substring(0, maxlimit-1);
}else{
field.value = field.value.substring(0, maxlimit);
}
}else{
countfield.value = maxlimit - field.value.length;
}
}
<tr>
<td width="100" align="right" valign="top" class="row4">
<bean:message key="reservation.ConfContents" />
:
</td>
<td class="row2" align="center">
<html:textarea property="conf_subject" cols="32" rows="5"
styleClass="input2" style="100%"
onkeydown="textCounter(conf_subject,remLen,255);"
onkeyup="textCounter(conf_subject,remLen,255);"
onmouseup="textCounter(conf_subject,remLen,255);"
onmousedown="textCounter(conf_subject,remLen,255);"
onmouseover="textCounter(conf_subject,remLen,255);"
onmouseout="textCounter(conf_subject,remLen,255);">
</html:textarea>
<br>
<bean:message key="reservation.InputLimit.prefix" />
<html:text property="remLen" readonly="true" size="4" maxlength="3" />
<bean:message key="reservation.InputLimit.suffix" />
</td>
</tr>