function checkLength(which,remainderNum,maxChars) { setTimeout(function() { if (which.value.length > maxChars) which.value = which.value.substring(0,maxChars); var curr = maxChars - which.value.length; //document.getElementById().innerHTML = curr.toString(); $("#"+remainderNum).text(curr); }, 100); } <div class="theme_con"><label>内容:</label><textarea name="_FSNR" class="theme_text_con" id="fsnrtextarea1" onpaste="checkLength(this,'remainderNum2',100);" onkeyup="checkLength(this,'remainderNum2',100);" onblur="checkLength(this,'remainderNum2',100);" style="400px;height:100px"></textarea></div>
使用了定时函数,主要是因为粘贴的时候,要等粘贴之后才能开始判断字符数.