-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnested_If.html
More file actions
27 lines (26 loc) · 778 Bytes
/
nested_If.html
File metadata and controls
27 lines (26 loc) · 778 Bytes
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Dashboard</title>
</head>
<body></body>
<script>
let userName = prompt("Enter Your Username:");
let role = prompt("Enter Your Role(admin / member / guest):");
if (userName.trim() !== "") {
if (role === "admin") {
alert("Welcome Admin! Redirecting to dashboard...");
} else if (role === "member") {
alert("Welcome Member! Redirecting to Homepage...");
} else if (role === "guest") {
alert("Stay in Homepage");
} else {
alert("Access Denied: Unknown role ");
}
} else {
alert("Please enter a username");
}
</script>
</html>