Entry
Can I limit the number of rows a user can type into a TEXTAREA (IE5.5 only)??
Jun 13th, 2002 02:48
M. Expósito, Patrick Mullin,
some code...:
Only limit the number of new lines
<SCRIPT>
function checkMaxRow (textarea, maxrow)
{
var cantidad = textarea.value.match(/\n+/g);
var cuenta = cantidad?cantidad.length:0;
if (cuenta < maxrow)
{ return true;}
else
{
textarea.selected = false;
return false;}
}
</SCRIPT>
And the call to function:
<textarea name="observaciones" cols="120" rows="15" wrap="HARD"
ONKEYDOWN="return checkMaxRow(this, 14)">