<head>
<title>验证只能为中文</title>
<script language="javascript">
function check(){
var t = document.forms[0].elements["text1"];
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="text1" />
</form>
</body>
</html>
posted on   WPF之家  阅读(121)  评论(0编辑  收藏  举报
努力加载评论中...

点击右上角即可分享
微信分享提示