顺便问下
/^([\u4E00-\u9FA5]|[A-Za-z])*$/
为啥这个不行?
------解决方案--------------------------------------------------------
/^([a-z\u4E00-\u9FA5])*$/i
------解决方案--------------------------------------------------------
- HTML code
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml" ><head> <title>Untitled Page</title> <script type="text/javascript"> function check() { alert(/^([a-z\u4E00-\u9FA5])+$/i.test(document.getElementById("aa").value)); } </script></head><body> <input type="text" id="aa" /><button onclick="check();">测试</button></body></html>
------解决方案--------------------------------------------------------
[\u4E00-\u9FA5]*[A-Za-z]*
------解决方案--------------------------------------------------------
/^([\u4E00-\u9FA5]|[A-Za-z])+$/
------解决方案--------------------------------------------------------
/^[a-z\u4E00-\u9FA5]*$/i