Вот сам скрипт
function flexibleTextarea(){
var _txt = document.getElementsByClassName('text');
var _minRows = 5;
if (_txt) {
function setRows() {
_txt.rows = _minRows;
do {
if (_txt.clientHeight != _txt.scrollHeight) _txt.rows += 1;
} while (_txt.clientHeight < _txt.scrollHeight);
}
setRows();
_txt.rows = _minRows;
_txt.onkeyup = function(){
setRows();
}
}
}
if (window.addEventListener)
window.addEventListener("load", flexibleTextarea, false);
else if (window.attachEvent)
window.attachEvent("onload", flexibleTextarea);