日期:2014-05-16 浏览次数:20315 次
<script type="text/javascript"> function checkLength(which) { var maxChars = 250; if (which.value.length > maxChars) which.value = which.value.substring(0,maxChars); var curr = maxChars - which.value.length; document.getElementById("chLeft").innerHTML = curr.toString(); } </script>
<table> <tr> <td> <textarea name="description" onkeyup="checkLength(this);"></textarea> <br /> <small><font color="red">文字最大长度: 100. 还剩:</font><font color="blue"> <span id="chLeft">100</span>.</font></small> </td> </tr> </table>