// But without using function and picking up more than one TEXTAREA
function autoResize()
{
objTextArea = document.getElementById('txtTextArea');
while (objTextArea.scrollHeight > objTextArea.offsetHeight)
{
objTextArea.rows += 1;
}
}
<textarea id="txtTextArea" onkeydown="autoResize()"></textarea>