console
<!DOCTYPE html>
<head runat="server">
<title>p1.2</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<table style="width:320px; text-align:center" border="1" cellpadding="6" cellspacing="0">
<tr>
<td colspan="2" bgcolor="#99CCFF">用户登录</td>
</tr>
<tr>
<td>用户名</td>
<td>
<input id="userId" type="text">
</td>
</tr>
<tr>
<td>密码</td>
<td>
<input id="passwordKey" type="password">
</td>
</tr>
<tr>
<td colspan="2">
<script>
function Button_Click(){
var x=document.getElementById("userId").value;
var y=document.getElementById("passwordKey").value;
if(x == "user" && y == "123456")
{
alert("登录成功");
}else if(x == "" || y == ""){
alert("用户名或密码为空");
}else{
alert("登录失败");
}
}
</script>
<button type="button" onclick="Button_Click()">登录</button>
</td>
</tr>
</table>
</div>
</form>
</body>