文本框字符长度动态统计

1.js

<script type="text/javascript">
          function setCount() {
              var txt = document.getElementById("txtValue");
              document.getElementById("count").innerText = txt.value.length + "";
          }
          setInterval('setCount()', 10);
</script>

 

2. 文本框

<textarea id="txtValue" style="width:80%;margin-left:5%;margin-top:3%" ></textarea>

3.动态统计显示

<span id="count" style="margin-left:70%"></span>/200

posted on 2016-03-29 16:19  执念saying  阅读(180)  评论(0编辑  收藏  举报

导航