<a href="/upload/20081125195529653.jpg" target="_blank"><img class="ubbimg" alt="/upload/20081125195529653.jpg" src="http://files.jb51.net/upload/20081125195529653.jpg" border="0"></a><br><div class="htmlarea"> <textarea id="runcode76559"> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>입력된 텍스트의 양에 따라 자동으로 너비를 변경하는 INPUT</title> <input name="words" size="2" maxlength="100" onkeyup="checkLength(this)"> <span id="char"> </span>0자 </textarea> <br><input onclick="runEx('runcode76559')" type="button" value="运行代码"><input onclick="doCopy('runcode76559')" type="button" value="复制代码"> <input onclick="doSave(runcode76559)" type="button" value="保存代码"> <a href="http://www.jb51.net/article/23421.htm" title="查看具体详情" target="_blank">[Ctrl A 모두 선택 참고: </a>외부 J를 도입해야 하는 경우 실행하려면 새로 고쳐야 합니다 </div>]<script language="javascript"> function checkLength(which) { var maxchar=20; var oTextCount = document.getElementById("char"); iCount = which.value.replace(/[^\u0000-\u00ff]/g,"aa").length; if(iCount<=maxchar) { oTextCount.innerHTML = "<font color=#FF0000>"+ iCount+""; which.style.border = '1px dotted #FF0000'; which.size=iCount+2; } else alert("请不要超过"+maxchar); } </script>