JS限制并且显示textarea字数

转自:https://www.cnblogs.com/shinepolo/articles/1373113.html
1 <script type="text/javascript"> function show(a,b) {
var maxl = 400
var s = document.getElementById(a).value.length + 1;
if (s > maxl)
document.getElementById(a).value = document.getElementById(a).value
.substr(0, maxl - 1)
else
document.getElementById(b).innerHTML = "已输入:" + s + "/" + maxl
+ " 字符"
}
</script> <s:textarea onkeydown="show();" id="a"></s:textarea>
<div><span id ="b">已输入字符:</span></div>
上一篇:饮冰三年-人工智能-Python-18Python面向对象


下一篇:如何让DevExpress TreeList的每个结点高亮显示?