-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
35 lines (33 loc) · 1.54 KB
/
index.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
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-giJF6kkoqNQ00vy+HMDP7azOuL0xtbfIcaT9wjKHr8RbDVddVHyTfAAsrekwKmP1" crossorigin="anonymous">
<title>Guess the button!</title>
</head>
<body style="background-color:powderblue;">
<div class="container">
<div class="card">
<div class="card-body" align="center">
<h1 style="color: red">Guess the button!</h1>
</div>
</div>
<div align="center">
<button type="button" class="btn btn-primary" id="0" onclick="guessing(this.id)">0</button>
<button type="button" class="btn btn-primary" id="1" onclick="guessing(this.id)">1</button>
<button type="button" class="btn btn-primary" id="2" onclick="guessing(this.id)">2</button>
</div>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js" integrity="sha384-ygbV9kiqUc6oa4msXn9868pTtWMgiQaeYH7/t7LECLbyPA2x65Kgf80OJFdroafW" crossorigin="anonymous"></script>
</body>
<script>
function guessing(idbutton) {
var nrbutton = Math.floor(Math.random() * 3);
if (idbutton == nrbutton) {
alert("Congratulations. You guessed the correct button.");
} else {
alert("Sorry, you choose the wrong button. The correct button is " + nrbutton + " Press F5 to play again");
}
}
</script>
</html>