一
(一)login.html
<!-- myapp/web/login.html -->
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>登录</title>
<script type="text/javascript">
function validate() {
var username = document.getElementById("username").value;
var password = document.getElementById("password").value;
if(username == "" || password == "") {
alert("用户名和密码均不能为空");
return false;
}
return true;
}
</script>
</head>
<body>
<div>
<h3>登录</h3>
<form action="dologin.php" method="post">
<div>
<span>用户名称</span>
<input type="text" id="username" name="username" />
</div>
<div>
<span>用户密码</span>
<input type="password" id="password" name="password" />
</div>
<div>
<input type="submit" value="登录" name="submit" onclick="return validate()"/>
<a href="register.html">注册</a>
</div>
</form>
</div>
</body>
</html>