英文和汉字的字节数本来就不同,如果是汉字应该除2

解决方案 »

  1.   

    <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
    <script>
    var arr
    function textCounter(obj, maxlimit) {
    var value = obj.value;
    if (value.length > maxlimit) {
    obj.value = value.substring(0, maxlimit);
    } else {
    document.all.remLen.value = maxlimit - value.length;
    }
    }
    </script>
    <body bgcolor="#FFFFFF" text="#000000">
    <font color=46A718>
    <input name=remLen value=50 readonly type=text size=4 maxlength=3 style="background-color: eaffe0; border: 0; color: red">
    </font><br>
    <textarea name=words style="width: 528px" rows=5 class=input1 onpropertychange="textCounter(this, 50)"></textarea>
      

  2.   

    在我这里测试没有发现这个问题,一切正常的啊?