2011年4月26日 星期二

[js] 使用JS控制textarea輸入框根據內容自動變化高度

<textarea rows=1 cols=40 style='overflow:scroll;overflow-y:hidden;;overflow-x:hidden'
onfocus="window.activeobj=this;this.clock=setInterval(function(){activeobj.style.height=activeobj.scrollHeight+'px';},200);" onblur="clearInterval(this.clock);">
js控制textarea输入框根据内容自动适应高度

沒有留言:

張貼留言