可以通过按钮来控制调节文本框高度,根据自己的需求来设定默认高度,也可以自定义最大值。
<html> <head> <meta http-equiv="content-Type" content="text/html;charset=gb2312"> <meta name="keywords" content="武鸣人网站,武鸣信息网,武鸣本地网,武鸣信息资源平台,减肥,健身,励志,励志语录,js特效,网页特效,www.wuming.ren"> <meta name="description" content="欢迎来到武鸣人信息资源平台,各种信息免费发布,资源共享合作共赢,分享互联网流行的励志语录经典短句,减肥健身健康小常识及打卡记录,收集各种js特效代码。"> <title>按钮控制调节文本框高度特效_武鸣人</title> <style type="text/css"> /* Reset style */ * {margin:0; padding:0; word-break:break-all;} body {background:#FFF; color:#333; font:12px/1.4em Helvetica, Arial, sans-serif;} h1, h2, h3, h4, h5, h6 {font-size:1em;} a {color:#333; text-decoration:none;} a:hover {text-decoration:underline;} ul, li {list-style:none;} fieldset, img {border:none;} input, textarea, select, button {font:12px Helvetica, Arial, sans-serif;} .button {padding:0 10px; height: 22px; border: 1px solid; border-color: #EEE #999 #999 #EEE; background: #DDD; color: #333; line-height: 20px; cursor: pointer; margin-left:2px;} .submit {padding:0 10px; height: 22px; border: 1px solid; border-color: #DDD #CC8305 #CC8305 #DDD; background: #FFA200; color: #FFF; line-height: 20px; letter-spacing: 1px; cursor: pointer;} /* edit_wuming style */ #edit_wuming {width:300px; margin:50px;} .edit_wuming_caption {width:100%; overflow:hidden; margin-bottom:1px; overflow:hidden;} .edit_wuming_caption span {display:block; float:left; margin:0 5px 0 0px; padding:2px 10px; background:#DDD; cursor:pointer;} .edit_wuming_caption span:hover {background:#EEE;} #edit_wuming textarea {width:300px; height:80px; margin:0; padding:0;} </style> <script type="text/javascript"> var addH=1; function addHeight_wuming_ren() { if (!document.getElementById('www_wuming_ren')) return flase; var comment = document.getElementById('www_wuming_ren'); var nowH = parseInt(comment.style.height); if (nowH < 250) { nowH+=2; comment.style.height=nowH+"px"; addH++; if (addH > 25){ addH=1; } else { window.setTimeout("addHeight_wuming_ren()","10"); } } }//武鸣人网站https://www.wuming.ren 网站很好记住,wuming.ren(武鸣拼音.ren域名后缀) function minHeight_wuming_ren() { if (!document.getElementById('www_wuming_ren')) return flase; var comment = document.getElementById('www_wuming_ren'); var nowH = parseInt(comment.style.height); if (nowH > 50) { nowH-=2; comment.style.height=nowH+"px"; addH++; if (addH > 25){ addH=1; } else { window.setTimeout("minHeight_wuming_ren()","10"); } } }//武鸣人网站https://www.wuming.ren 网站很好记住,wuming.ren(武鸣拼音.ren域名后缀) </script> </head> <body> <a href="https://www.wuming.ren">武鸣人</a>,各种信息资源免费发布,分享励志语录经典短句,减肥健身常识,各种js特效代码。网站很好记住,wuming.ren(武鸣拼音.ren域名后缀)<hr> <!--欢迎来到武鸣人信息资源平台,各种信息免费发布,资源共享合作共赢,分享互联网流行的励志语录经典短句,减肥健身健康小常识及打卡记录,收集各种js特效代码。--> <script type="text/javascript" src="https://www.wuming.ren/ad/tc.js"></script> <script type="text/javascript" src="https://www.wuming.ren/ad/a.js"></script> <div id="edit_wuming"> <div class="edit_wuming_caption"> <span onclick="addHeight_wuming_ren()">放大</span> <span onclick="minHeight_wuming_ren()">缩小</span> </div> <div><textarea id="www_wuming_ren" name="www_wuming_ren" tabindex="1" rows="8" style="height:100px">武鸣人,各种信息资源免费发布,分享励志语录经典短句,减肥健身常识,各种js特效代码! </textarea> </div> </div> </body> </html>
本文来自武鸣人网站,转载请注明出处