-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
85 lines (75 loc) · 1.93 KB
/
Copy pathindex.html
File metadata and controls
85 lines (75 loc) · 1.93 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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
<html>
<body>
<h1>Guessing Game</h1>
<p>This is the Guessing Game. You have to try to guess the number between the two numbers in the description. There are lots of different levels and are harder the higher you go. Click Start to begin!</p>
<br>
<button onClick="levelOne()">Level 1</button>
<button onClick="levelTwo()">Level 2</button>
<button onClick="levelThree()">Level 3</button>
<button onClick="levelFour()">Level 4</button>
<style>
body {
background-color: orange;
}
h1, p {
text-align: center;
color: blue;
}
p {
color: rgb(50, 50, 255);
}
button {
background-color: rgb(255, 100, 30);
font-weight: bold;
border-style: double;
border-style: solid;
border-color: #ff0000 #00ff00 #0000ff rgb(250,0,255);
}
</style>
<script>
function levelOne() {
var guess=prompt("What is your guess for 1-10?");
var answer=2
if (answer==guess) {
alert("Good job, you got it right! Move on to Level 2.");
}
else if (answer>guess) {
alert("That is too low. Click Level 1 to try again!");
guess;
}
else if (answer<guess) {
alert("That is too high. Click Level 1 to try again!");
guess;
}
}
function levelTwo() {
var guess=prompt("What is your guess for 1-50?");
var answer=49;
if (answer==guess) {
alert("Good job, you got it right! Move on to Level 3.");
}
else if (answer>guess) {
alert("That is too low. Click Level 2 to try again!");
guess;
}
else if (answer<guess) {
alert("That is too high. Click Level 2 to try again!");
guess;
}
}
function levelThree() {
var guess=prompt("What is your guess for 1-10? This time, you have to guess two numbers in this format: smallernumber and biggernumber. Good luck!");
var answer="2";
if (answer==guess) {
alert("Good job, you got it right! Move on to Level 3.");
}
else if (answer>guess) {
alert("That is too low. Click Level 3 to try again!");
}
else if (answer<guess) {
alert("That is too high. Click Level 3 to try again!");
}
}
</script>
</body>
</html>