-
Notifications
You must be signed in to change notification settings - Fork 0
/
omikuji_tpl.html
41 lines (39 loc) · 1018 Bytes
/
omikuji_tpl.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
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width" />
<script src="js/jquery-2.1.3.min.js"></script>
<link rel="stylesheet" href="css/sample.css" />
<title>おみくじ</title>
</head>
<body>
<header>
<h1>おみくじ</h1>
</header>
<main>
<ul>
<li id="pull">おみくじを引く</li>
</ul>
<p id="echo"></p>
</main>
<footer>フッター</footer>
<script>
$("#pull").on("click", function () {
const r = Math.ceil(Math.random() * 5);
console.log(r);
if (r == 1) {
$("#echo").html('<img src="img/daikichi.webp" width="400">');
} else if (r == 2) {
$("#echo").html("中吉");
} else if (r == 3) {
$("#echo").html("小吉");
} else if (r == 4) {
$("#echo").html("吉");
} else if (r == 5) {
$("#echo").html("大凶");
}
});
</script>
</body>
</html>