1. <p>你还可以输入<em id="section">0</em>/150</p>
    2. <textarea cols="30" rows="10" id="txt"></textarea>
    3. <script>
    4. var em = document.getElementById("section");
    5. var txt = document.getElementById("txt");
    6. txt.onkeyup = function(){
    7. var length = this.value.length;
    8. em.innerHTML = length;
    9. }
    10. </script>

    test.gif