-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex3.html
103 lines (92 loc) · 2.17 KB
/
index3.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
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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
<!DOCTYPE html>
<html>
<head>
<title>Truth or Dare</title>
<style>
body {
font-family: Arial, sans-serif;
text-align: center;
margin-top: 50px;
}
h1 {
color: #333;
font-size: 36px;
margin-bottom: 30px;
}
.btn {
display: inline-block;
padding: 10px 20px;
font-size: 24px;
font-weight: bold;
text-align: center;
color: #fff;
background-color: #f00;
border: none;
border-radius: 5px;
cursor: pointer;
margin: 10px;
}
.modal {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, 0.5);
display: none;
}
.modal-content {
width: 300px;
height: 500px;
margin: 0 auto;
background-color: #fff;
border-radius: 5px;
position: relative;
top: 50%;
transform: translateY(-50%);
padding: 20px;
}
.close-btn {
position: absolute;
top: 10px;
right: 10px;
font-size: 24px;
font-weight: bold;
color: #333;
cursor: pointer;
}
.close-btn:hover {
color: #f00;
}
</style>
</head>
<body>
<h1>Truth or Dare</h1>
<button class="btn" id="truth-btn">真心话</button>
<button class="btn" id="dare-btn">大冒险</button>
<div class="modal" id="modal">
<div class="modal-content">
<span class="close-btn" id="close-btn">×</span>
<p id="modal-text"></p>
</div>
</div>
<script>
var truthBtn = document.getElementById("truth-btn");
var dareBtn = document.getElementById("dare-btn");
var modal = document.getElementById("modal");
var closeBtn = document.getElementById("close-btn");
var modalText = document.getElementById("modal-text");
truthBtn.onclick = function() {
modal.style.display = "block";
modalText.innerHTML = "你有没有告诉过一个谎话,是什么?";
}
dareBtn.onclick = function() {
modal.style.display = "block";
modalText.innerHTML = "做个鬼脸给大家看!";
}
closeBtn.onclick = function() {
modal.style.display = "none";
}
</script>
</body>
</html>