【Código HTML】
<Able> <tr> <td> contenido de sms: </td> <td> <textarea name = "mensaje" cols = "96" filas = "5" onkeydown = "textCounter (mensaje, remlen, 65);" onkeyup = "textCounter (mensaje, remlen, 65);"> </textAREA> <TD> </tr> <TD> <TD> <TD> <TD> <TD> <TD> <TD> name = "remlen" type = "text" value = "65" size = "5" readonly = "readonly"> caracteres, y el número máximo de caracteres permitidos para cada mensaje de texto es <strong> 65 </strong> caracteres </td> </tr> </table>
【Código JS relevante】
<Script> Función TextCounter (Field, CountField, MaxLimit) {if (Field.Value.Length> MaxLimit) Field.Value = Field.Value.Substring (0, MaxLimit); ElSecountfield.Value = MaxLimit - Field.Value.length;} </script>