onchange啦
<input type="text" name="text1" onchange="checkme()">
<script>
 function checkme(){
    var txt = document.frm.text1 ;
        alert( txt.value.length ) ;//在此作你想要的动作
 }
</script>