今日学习内容
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 = "zhiyuan_gongneng.jsp";
} else if (username === "111111" && password === "123") {
window.location.href = "jingli_gongneng.jsp";
}
else if (username === "222222" && password === "123") {
window.location.href = "zongjingli_gongneng.jsp";
}
else if (username === "222222" && password === "123456") {
window.location.href = "caiwu_gongneng.jsp";
}
else {
alert("用户名或密码错误");
}
});
event.preventDefault(); // 阻止表单默认提交行为
var username = document.getElementById("username").value;
var password = document.getElementById("password").value;
// 基本验证
if (username === "123456" && password === "123") {
window.location.href = "zhiyuan_gongneng.jsp";
} else if (username === "111111" && password === "123") {
window.location.href = "jingli_gongneng.jsp";
}
else if (username === "222222" && password === "123") {
window.location.href = "zongjingli_gongneng.jsp";
}
else if (username === "222222" && password === "123456") {
window.location.href = "caiwu_gongneng.jsp";
}
else {
alert("用户名或密码错误");
}
});