-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
30 lines (27 loc) · 1.17 KB
/
script.js
File metadata and controls
30 lines (27 loc) · 1.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
function signup() {
const username = document.getElementById("signupUsername").value;
const password = document.getElementById("signupPassword").value;
localStorage.setItem("username", username);
localStorage.setItem("password", password);
alert("Sign up successful! Redirecting to login...");
window.location.href = "index.html";
}
function login() {
const username = document.getElementById("loginUsername").value;
const password = document.getElementById("loginPassword").value;
const storedUser = localStorage.getItem("username");
const storedPass = localStorage.getItem("password");
if (username === storedUser && password === storedPass) {
alert("Login successful!");
window.location.href = "details.html";
} else {
alert("Invalid credentials. Try again.");
}
}
function submitDetails() {
const fullName = document.getElementById("fullName").value;
const age = document.getElementById("age").value;
const email = document.getElementById("email").value;
console.log("Submitted Details:", { fullName, age, email });
alert("Details submitted successfully!");
}