<textarea id="runcode6733"><! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd "> <ptml xmlns=" http://www.w3.org/1999/xhtml "> <pead> <meta http-equiv=" Content-type "content=" text/html; charset=gb2312 "/> <title> Untitled document </title> <script language=" JavaScript "> Function checklength ( which) {var maxchar=100; var otextcount = document.getElementById ("char"); icount = Which.value.replace (/[^\u0000-\u00ff]/g, "AA"). Length; if (Icount<=maxchar) {otextcount.innerhtml = "<font color= #FF0000 >" + icount+ "</font>"; Which.style.border = ' 1px dotted #FF0000 '; which.size=icount+2; else alert ("Please do not exceed" +maxchar); } </script> </pead> <body> <input name= "Words" size= "2" maxlength= "onkeyup=" Checklength (this ) "/> <span id=" char ">0</span> characters </body> </ptml></textarea>
[Ctrl + A All SELECT Note: If the need to introduce external JS need to refresh to perform]
<center> input height fixed, automatic widening <input type= "text" > TextArea width fixed, automatic elevation <textarea type= "text" ></t Extarea>
[Ctrl + A All SELECT Note: If the need to introduce external JS need to refresh to perform]
Thanks to the Netizen "Liufabin" raised on the issue of not supporting FF, the first in the FF tested under the support of the second high degree of adaptive does not support, I found a jquery plug-in online, the plug-in address is: http://plugins.jquery.com/ Project/autogrow need to use the JS file address for
Http://img.jb51.net/jslib/jquery/jquery.autogrow.js
<textarea id="runcode56094"><! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd "> <ptml xmlns=" http://www.w3.org/1999/xhtml "> <pead> <meta http-equiv=" Content-type "content=" text/html; charset=gb2312 "/> <title>input width adaptive 2009-05-28</title> <script type=" Text/javascript "src=" http:/ /img.jb51.net/jslib/jquery/jquery-1.3.2.min.js "></script> <script type=" Text/javascript "src=" http:// Img.jb51.net/jslib/jquery/jquery.autogrow.js "></script> <script type=" Text/javascript "> $ (function () {$ ("#textarea"). autogrow (); }) </script> </pead> <body> <!----> <textarea id= "textarea" will appear when the minimum is high 80PX ></textar ea> </body> </ptml></textarea>
[Ctrl + A All SELECT Note: If the need to introduce external JS need to refresh to perform]