Kód:
<script>
function checksize(txa)
{
var r = txa.rows;
var c = txa.cols;
var v = txa.value;
var mr = 20; //maximalny pocet riadkov
var mc = 60; //maximalny pocet stlpcov
var l = v.split('\n');
r = l.length > r ? l.length : r;
for (var i in l)
{
c = l[i].length > c ? l[i].length : c;
}
txa.rows = r<mr ? r : mr;
txa.cols = c<mc ? c : mc;
}
</script>
<textarea cols=30 rows=5 onkeyup="checksize(this)"></textarea>
Malo by to zvacsovat textareu do sirky aj do vysky, az dovtedy, kym hodnota atributu rows, resp. cols nedosiahne hodnotu atributu mr, resp. mc. Pravdepodobne bude nutne nastavit v textarei cols aj rows.