<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档 </title>
</head>
<body>
<input type="text" name="name" id="name" onblur='checkname(this)'/>
</body>
<script type="text/javascript">
function checkname(t) {
var pat = new RegExp("[^a-zA-Z0-9\u4E00-\u9FA5]");
if (pat.test(t.value)==true) {
alert('输入含有非法字符!');
}
else {
alert('合法字符!');
}
}
</script>
</html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档 </title>
</head>
<body>
<input type="text" name="name" id="name" onblur='checkname(this)'/>
</body>
<script type="text/javascript">
function checkname(t) {
var pat = new RegExp("[^a-zA-Z0-9\u4E00-\u9FA5]");
if (pat.test(t.value)==true) {
alert('输入含有非法字符!');
}
else {
alert('合法字符!');
}
}
</script>
</html>
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货