記錄一下今天發現的小技巧,原來還有oninput事件
記錄一下今天發現的小技巧,原來還有oninput事件,請參考oninput,onpropertychange,onchange的用法和区别,以下是HTML與JS:
	<textarea onpropertychange="setHeight(this);" onmouseover="setHeight(this);" 
	onpaste="setHeight(this);" oninput="setHeight(this);">
	</textarea>
function setHeight(obj) 
{
     obj.style.height = obj.scrollHeight + 'px';
}