Code
<script language="JavaScript">
function countLines(strtocount, cols) {
var hard_lines = 1;
var last = 0;
while ( true ) {
last = strtocount.indexOf("\n", last+1);
hard_lines ++;
/* if ( hard_lines == 35) break; */
if ( last == -1 ) break;
}
var soft_lines = Math.ceil(strtocount.length / (cols-1));
var hard = eval("hard_lines " + unescape("%3e") + "soft_lines;");
if ( hard ) soft_lines = hard_lines;
return soft_lines;
}
function cleanForm() {
var the_form = document.getElementById('ta');
the_form.rows = countLines(the_form.value,the_form.cols) +1;
setTimeout("cleanForm();", 500);
}
cleanForm();
</Script>