js代码
textareaHeight:function(){
$("textarea").bind("input propertychange focus", function () {
this.style.posHeight = this.scrollHeight;
});
$("textarea").each(function () {
this.style.posHeight = this.scrollHeight;
});
}
HTML代码
<textarea style="width:100%;">
IE支持 onPropertyChange 火狐支持oninput
IE支持 onPropertyChange
火狐支持oninput
</textarea>
原文:http://www.cnblogs.com/recent/p/3597929.html