<script type="text/javascript" >
$(function(){
var $comment = $('#comment');
var $str = $('#str');
var time;
$comment.focus(function(){
time = window.setInterval( substring,100 );
});
function substring() {
var val = $comment.val();
var length = val.length;
if( $str.html() != (length) ){
if(length==0){
$("#wordcount")[0].firstChild.nodeValue = "您已输入0";
$str.html(length);
}else{
$("#wordcount")[0].firstChild.nodeValue = "您已输入";
$str.html(length);
}
}
}
});
</script>
<p id="wordcount">
您已输入<span id="str">0</span>字
</p>
via:http://wange.im/comment-count-in-wordpress-with-jquery.html