<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html>
<body>
<textarea onkeyup="MaxMe(this)" style="overflow: hidden"></textarea>
<script type="text/javascript">
function MaxMe(o) {
if (window.navigator.userAgent.indexOf("Firefox") > -1) {
o.style.height = o.scrollTop + o.scrollHeight + "px";
}
else {
if (o.scrollTop > 0) o.style.height = o.scrollTop + o.scrollHeight + "px";
}
}
</script>
<div id="debug"></div>
</body>
</html>
textarea自动变换高度
最新推荐文章于 2024-04-18 14:46:56 发布