让textarea自动调整大小的js代码
时间:2021-05-10 08:41:49|栏目:JavaScript代码|点击: 次
复制代码 代码如下:
<!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 class='editable' 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>
上一篇:JS中准确判断变量类型的方法
栏 目:JavaScript代码
本文标题:让textarea自动调整大小的js代码
本文地址:http://www.codeinn.net/misctech/118201.html






