日期:2014-05-16  浏览次数:20399 次

js验证中能输入中文英文
<!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>

?