codice:
<!doctype html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Esempio</title>
<script type="text/javascript">
function checkRows(oKeyEvent, oField, nRows) {
	return oKeyEvent.keyCode !== 13 || (oField.value.match(/\n/g) || "").length < nRows - 1;
}
</script>
</head>

<body>
<form name="myForm">


<textarea cols="50" rows="10" name="myInput" onkeydown="return checkRows(event, this, 5 /* qui il numero di righe! */);" onpaste="return false;" /></textarea></p>
</form>
</body>
</html>