-
Notifications
You must be signed in to change notification settings - Fork 4
/
choice.html
42 lines (34 loc) · 1.33 KB
/
choice.html
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
31
32
33
34
35
36
37
38
39
40
41
42
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Choose Hotels/ Flights</title>
<link rel="stylesheet" href="./CSS/choicePage.css">
</head>
<body>
<div id="logOutButton">Log Out<span></span></div>
<h1 id="greeting">Welcome, <span id="greetFor"></span>!</h1>
<div id="manageField">
<a href="./flight.html"><div id="editHotels" class="chooseToEdit"><img src="./plane.png" alt=""><span>Book a Flight</span></div></a>
<a href="./hotels.html"><div id="editFlights" class="chooseToEdit"><img src="./hotel.png" alt=""><span>Book a Hotel</span></div></a>
</div>
</body>
</html>
<script>
let userName = localStorage.getItem("userName") || "x";
console.log(userName)
let greetFor = document.querySelector("#greetFor");
greetFor.textContent = userName;
if(userName=="x"){
window.location.href = "login-signup.html";
alert("Please login First!!!");
}
let userLogOut = document.querySelector("#logOutButton");
userLogOut.addEventListener("click",function(){
localStorage.removeItem("userName");
localStorage.removeItem("userPass");
window.location.href = "login-signup.html";
})
</script>