Thứ Tư, 5 tháng 6, 2013

JS - Đếm ký tự trong textBox



 Demo 1:
<style>
textarea.in{width:100%;height:500px;}
input.out{width:auto;border:0;}
</style>
<script>
  function dem()
  {
    str= fdem.text.value;
    fdem.kq.value=str.length;
  }
</script>
<form name='fdem' method='post' action='#'>
  <textarea name='text' onkeyup='dem()' onclick='this.select()' class='in'></textarea>
  <input name ='kq' class='out' />
</form>


TTTj - bendoi.vn

Chủ đề: