<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>My JSP 'MyJsp.jsp' starting page</title>
<script type="text/javascript">
function checkFormat(str)
{
if (escape(str).indexOf("%u")!=-1)
{
alert("不能含有汉字");
}
else if(str.match(/\D/)!=null)
{
alert('不能含有字母');
}
}
</script>
</head>
<body>
<input name="aa" type="text" οnblur="checkFormat(this.value)">
</body>
</html>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>My JSP 'MyJsp.jsp' starting page</title>
<script type="text/javascript">
function checkFormat(str)
{
if (escape(str).indexOf("%u")!=-1)
{
alert("不能含有汉字");
}
else if(str.match(/\D/)!=null)
{
alert('不能含有字母');
}
}
</script>
</head>
<body>
<input name="aa" type="text" οnblur="checkFormat(this.value)">
</body>
</html>