如题所述
固定的吗?下面这个必须用户名和密码都得是 admin 才可以
<html><head>
<title>My JSP 'MyJsp.jsp' starting page</title>
<script type="text/javascript">
function login(){
var username=window.document.getElementById("username").value;
var password=window.document.getElementById("password").value;
if(username=="admin" && password=="admin")
{
alert("登录成功!");
}else{
alert("登录失败!");
return false;
}
}
</script>
</head>
<body>
<input type="text" id="username"/>
<input type="password" id="password"/>
<input type="button" onclick="login()" value="登录"/>
</body>
</html>
温馨提示:答案为网友推荐,仅供参考