-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathExercise13pt4.html
46 lines (37 loc) · 1.23 KB
/
Exercise13pt4.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
43
44
45
46
<!DOCTYPE html>
<!-- saved from url=(0080)file:///Users/kalisafalzone/Programming/MakerSquare/JuneClass/Exercise13pt4.html -->
<html><head><meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
</head>
<body>
<div id="greeting"></div>
<script>
var name = prompt ("Please enter your name", "Kalisa")
var age = prompt ("Please enter your age", "30")
var gender = prompt ("Please enter your gender: M/F", "F")
var isMember = prompt ("Are you a member? Y/N", "Y")
if (gender === "M") {
membergreeting = "Mr.";
nonmembergreeting = "Sir";
} else {
membergreeting = "Mrs.";
nonmembergreeting = "Ma'am";
};
if (isMember === "N" || age < 21) {
document.querySelector("#greeting").textContent = "I'm sorry " + nonmembergreeting + " you do not have access";
};
if (isMember === "Y" && age >= 21) {
var thirsty = confirm("Are you thirsty?");
if (thirsty) {
var drink = prompt("What would you like to drink?")
if (drink === "Coors Light"){
alert("You are kicked out!");
isMember = "N"
} else {
alert("One " + drink + " coming right up!")
};
}
};
if (isMember === "Y")
document.querySelector("#greeting").textContent = "Welcome " + membergreeting + " " + name + "!";
</script>
</body></html>