{
font-family: Arial, sans-serif;
margin: 0;
padding: 20px;
}
h1 {
text-align: center;
}
#loginForm, #studentInfo {
max-width: 300px;
margin: 0 auto;
text-align: center;
}
input[type="text"], input[type="password"] {
width: 100%;
padding: 10px;
margin-bottom: 10px;
}
button {
padding: 10px 20px;
background-color: #4CAF50;
color: #fff;
border: none;
cursor: pointer;
}
button:hover {
background-color: #45a049;
}
#studentInfo p {
margin-bottom: 10px;
}
function login() {
var username = document.getElementById("username").value;
var password = document.getElementById("password").value;
// Perform authentication, e.g., check credentials with a server-side database
// For simplicity, let's assume username is "student" and password is "password"
if (username === "student" && password === "password") {
document.getElementById("loginForm").style.display = "none";
document.getElementById("studentInfo").style.display = "block";
document.getElementById("studentName").textContent = "Name: John Smith";
document.getElementById("studentID").textContent = "Student ID: 123456";
document.getElementById("studentMajor").textContent = "Major: Computer Science";
} else {
alert("Invalid credentials. Please try again.");
}
}
function logout() {
document.getElementById("loginForm").style.display = "block";
document.getElementById("studentInfo").style.display = "none";
document.getElementById("username").value = "";
document.getElementById("password").value = "";
}