匹配里使用非模式,而不是测试是否包含中文的模式:
if(/[^\u4e00-\u9fa5]/.test(str)) alert("error");

解决方案 »

  1.   

    <input type=text onkeyup="value=value.replace(/[^\u0391-\uFFE5]+/g,'')"/>   
    试试上面的还有你是不是不是严格的验证,只能是中文  var re=/^([\u0391-\uFFE5]+)$/g;
      

  2.   

    <script>
    re=/^[\u4e00-\u9fa5]*$/
    alert(re.test("asasd"))
    alert(re.test("按时的"))
    </script>
      

  3.   

    hbhbhbhbhb1021,为空也可以
    <script>
    re=/^[\u4e00-\u9fa5]*$/
    alert(re.test(""))
    </script>
      

  4.   

    hbhbhbhbhb1021,为空也可以
    <script>
    re=/^[\u4e00-\u9fa5]+$/
    alert(re.test(""))
    </script>