今日学习内容
document.getElementById("login-form").addEventListener("submit", function (event) {event.preventDefault(); // 阻止表单默认提交行为
var username = document.getElementById("username").value;
var password = document.getElementById("password").value;
// 基本验证
if (username === "123456" && password === "123") {
window.location.href = "xuesheng_gongneng.jsp";
} else if (username === "111111" && password === "123") {
window.location.href = "jiaoshi_gongneng.jsp";
}
else if (username === "222222" && password === "123") {
window.location.href = "guanliyuan_gongneng.jsp";
}
else if (username === "123456" && password === "123456") {
window.location.href = "xuesheng_gongneng.jsp";
}
else {
alert("用户名或密码错误");
}
}); 标签:username,11.24,window,href,&&,gongneng,password From: https://www.cnblogs.com/zjm921/p/17908608.html