用正则表达式
<script language=javascript>
function check(form)
{
var reg=/^[\u4e00-\u9fa5]+$/;
if(!reg.test(form.t1.value))
{
alert("只能输入中文!");
form.t1.focus();
return false;
}
return true;
}
</script>
<form name=form1>
<input type=text name=t1>
<input type=submit value="提交" onclick="return check(this.form);">
</form>