<script language="javascript">
function check(){
var t = document.forms[0].elements["username"];
if (t.value != t.value.replace(/[^\u4E00-\u9FA5]/g,'')){
alert("不是中文");
}
}
</script>
</head>
<body>
<form id="form1" name="form1" method="post" action="">
<input type="button" name="btn" value="提交" onclick="check()" />
<input type="text" name="username" />
</form>
温馨提示:内容为网友见解,仅供参考