哇,好久不见啊...
我也贴一个
:D/^[\S\s]{6,16}$/

解决方案 »

  1.   

    aa.replace(/[^\x00-\xff]/g,"--")先要把全角替换掉
      

  2.   

    //来自月影的silverna-packs.js  
    //可直接用长度判断
    String.prototype.bytes = function()
    {
    return this.replace(/[^\x00-\xff]/g,"--").length;
    }
      

  3.   

    谢谢,麻烦高手在提供个详细点的用来判断输入文本框的字数在6~16的function函数..
    我发现我不会用楼上提供的 = =
      

  4.   


    <script>
    String.prototype.bytes   =   function()
    {
    return   this.replace(/[^\x00-\xff]/g,"--").length;
    }
    var a="12321adas"
    alert(a.bytes())
    if(a.bytes()<16){
       alert('err')
    }
    </script>
      

  5.   

    function aa(){
    var str="";
    str = document.getElementById("test").value;//这个获取文本框的值会吧?
    if(str.length<6||str.length>16){
    alert("字符长度不在限制范围内");
    return false;
    }
    }
    触发函数会吧?