<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<script type="text/javascript">
function $(id) {
return document.getElementById(id);
}
function check() {
var user = $("user").value;
var pwd = $("pwd").value;
$("userInfo").innerHTML="";
$("pwdInfo").innerHTML="";
if(user == "") {
$("userInfo").innerHTML="用户名不能为空!";
$("user").focus();
return false;
}
if(pwd == "") {
$("pwdInfo").innerHTML="密码不能为空!";
$("pwd").focus();
return false;
}
return true;
}
</script>
<style type="text/css">
#userInfo{color:red;}
#pwdInfo{color:red;}
</style>
<title>登录</title>
</head>
<body>
<center>
<form action="loginResult.jsp" method="post" onsubmit="return check()">
<br><br><br><br><br><br>
<table>
<tr><td>用户名:</td><td><input type="text" name="userName" id="user"><span id="userInfo" ></span></td></tr>
<tr><td>密码:</td><td><input type="password" name="userPwd" id="pwd"><span id="pwdInfo"></span></td></tr>
<tr><td></td><td><input type="submit" value="登 录"></td>
</table>
</form>
</center>
</body>
</html>