JS正则验证字符串的语法问题
<html> <head> <title>字符串格式检验</title> <script> function checkStrFormat(str) { if(/^([a-zA-Z_]{1})([\w]*)$/g.test(this.value)) { alert("just letter is permitted"); // 报警提示语句。 } } </script> </head> <body> <form name="timeForm" action="resultOK.html"> <input type="text" onblur="checkStrFormat(this.value)"> </form> </body></html>