[代码]文本框最多140字是怎么做的?
<HTML>
<HEAD>
<TITLE>游客发表留言最多140字 是怎么做的?</TITLE>
<script type="text/javascript">
function checkLength(which) {
var maxChars = 140;
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>
</HEAD>
<BODY>
<textarea name="SayContent" id="SayContent" rows="8" cols="62" class="textarea" onKeyUp="checkLength(this)"></textarea><br><br>剩余:<span id="chLeft" style="color:#FF0000;">140</span> 个文字
<br><br>
<a href="http://xxrblog.cn/dh/" target="_blank">乡下人 导航</a><br><br>
转载请注明出处 乡下人'blog http://xxrblog.cn
</BODY>
</HTML>
<HEAD>
<TITLE>游客发表留言最多140字 是怎么做的?</TITLE>
<script type="text/javascript">
function checkLength(which) {
var maxChars = 140;
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>
</HEAD>
<BODY>
<textarea name="SayContent" id="SayContent" rows="8" cols="62" class="textarea" onKeyUp="checkLength(this)"></textarea><br><br>剩余:<span id="chLeft" style="color:#FF0000;">140</span> 个文字
<br><br>
<a href="http://xxrblog.cn/dh/" target="_blank">乡下人 导航</a><br><br>
转载请注明出处 乡下人'blog http://xxrblog.cn
</BODY>
</HTML>