主题:javascript验证,程序挺不下来,是怎么回事?
javascript验证,程序挺不下来,是怎么回事?
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<script language="javascript">
function validate(){
alert("error");
document.form.username.focus();
return false;
}
</script>
</head>
<body>
This is my JSP page. para<br>
<form name="form">
<input type="text" name="username">
<input type="text" name="ip">
<br>
<input type="submit" name="submit" value="submit" onclick="validate();">
<input type="reset" name="reset" value="reset">
</form>
</body>
</html>
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<script language="javascript">
function validate(){
alert("error");
document.form.username.focus();
return false;
}
</script>
</head>
<body>
This is my JSP page. para<br>
<form name="form">
<input type="text" name="username">
<input type="text" name="ip">
<br>
<input type="submit" name="submit" value="submit" onclick="validate();">
<input type="reset" name="reset" value="reset">
</form>
</body>
</html>