JavaScript中统计Textarea字数并提示还能输入的字符
<span style="font-size:18px;"><script language="javascript"> function countChar(textareaName,spanName) { document.getElementById(spanName).innerHTML = 140 - document.getElementById(textareaName).value.length; } </script> 可以输入<span id="counter">140</span>字<br/> <textarea id="status" name="status" rows="6" cols="40" onkeydown='countChar("status","counter");' onkeyup='countChar("status","counter");'></textarea></span>
转载请注明出处: 欢迎留言或qq(1090413588)交流