<%@ page contentType="text/html;charset=GBK" %>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>表单验证</title>
<script language="JavaScript">
<!--
function checkdata() {
	var txt = document.forms[0].num.value;
	if(txt.search("^\\d+(\\.\\d+)*$")!=0) {
		alert("请输入数字");
		document.forms[0].num.select();
		return false;
	}
	
	txt = document.forms[0].int.value;
	if(txt.search("^-?\\d+$")!=0) {
		alert("请输入整数");
		document.forms[0].int.select();
		return false;
	}
	
	txt = document.forms[0].email.value;
	if(txt.search("^\\w+([-+.]\\w+)*@\\w+([-.]\\w+)*\\.\\w+([-.]\\w+)*$")!=0) {
		alert("请输入电子邮件");
		document.forms[0].email.select();
		return false;
	}
	
	return true;
}
-->
</script>
</head>
<body>
<p>
<form action="action_checkdata.jsp" method="post" OnSubmit="return checkdata()">
<p>请输入一个数字:<input type="text" name="num">
<p>请输入一个整数:<input type="text" name="int">
<p>请输入电子邮件:<input type="text" name="email">

<p><input type="submit" value="检查并提交">
<form>

</body>
</html>