<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML> <HEAD> <TITLE> New Document </TITLE> <META NAME="Generator" CONTENT="EditPlus"> <META NAME="Author" CONTENT=""> <META NAME="Keywords" CONTENT=""> <META NAME="Description" CONTENT=""> <script> function check(str) { reg = /^([\u4E00-\u9FA5]|[A-Za-z0-9])*$/; if(reg.test(str)) { alert("ok"); } else { alert("请输入用户名只能是中文英文和数字"); } } </script> </HEAD> <BODY> <input type="text" name="aaa"> <input type="button" value="test" onclick="check(document.getElementById('aaa').value)"> </BODY> </HTML>
?