Core code: Copy code The code is as follows: <br>function adjustObjHeight(obj, defaultHeight) { <br>if(obj.scrollHeight > defaultHeight) { <br>obj.style.height = obj.scrollHeight 'px'; <br>} else { <br>obj.style.height = defaultHeight 'px'; <br>} <br>} <br>window.onload = function() { <br>var obj = document.getElementsByTagName('textarea' ); <br>var len = obj.length; <br>for(var i = 0; i<len; i ) <BR>adjustObjHeight(obj[i], 50); <BR>} <BR>< /script> <br> </div> <br>TextArea HTML code: <br><div class="codetitle"> <span><a style="CURSOR: pointer" data="75226" class="copybut" id="copybut75226" onclick="doCopy('code75226')"><u>Copy code</u></a></span> The code is as follows: </div> <div class="codebody" id="code75226"> <br><textarea id="content" onkeyup="adjustObjHeight(this, 50);"></textarea> <br> </div> <br>Author He Chaoyang