让textarea自动调整大小的js代码
发布时间:2016-12-30 来源:查字典编辑
摘要:复制代码代码如下:自动调整大小的textarea.editable{cursor:text;font-size:13px;color:#00...
复制代码 代码如下:
<!doctype html>
<html>
<head>
<title>自动调整大小的textarea </title>
<meta charset = "utf-8" />
<style type = "text/css">
.editable{cursor:text; font-size:13px; color:#003366;width:80px;line-height:20px;height:20px;font-family:Arial;cursor:text;*overflow-y:hidden; }
</style>
</head>
<body>
<textarea onkeydown ="if(event.keyCode==13) return false; " oninput="this.style.height='0px';this.style.height=(this.scrollHeight+'px');" onpropertychange="this.style.height=(this.scrollHeight+'px')" /></textarea>
</body>
</html>