-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathage.html
More file actions
executable file
·31 lines (28 loc) · 868 Bytes
/
age.html
File metadata and controls
executable file
·31 lines (28 loc) · 868 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
28
29
30
31
<html>
<head>
<title>CHECK AGE</title>
</head>
<script type="text/javascript">
function act() {
var num = prompt('enter an age');
var message = canIWatch(num);
alert(message);
}
function canIWatch(age) {
if (age >0 && age < 6) {
return "You are not allowed to watch Deadpool after 6.00pm.";
} else if (age >= 6 && age < 17) {
return "You must be accompanied by a guardian who is 21 or older.";
} else if (age >= 17 && age < 25) {
return "You are allowed to watch Deadpool, right after you show some ID.";
} else if (age >= 25) {
return "Yay! You can watch Deadpool with no strings attached!";
} else {
return "Invalid age";
}
}
</script>
<body>
<button id="click" onclick="act()">Click me</button>
</body>
</html>