-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
77 lines (68 loc) · 2.49 KB
/
Copy pathindex.html
File metadata and controls
77 lines (68 loc) · 2.49 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
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>系统警告</title>
<style>
body {
font-family: 'Microsoft YaHei', sans-serif;
background-color: #f0f2f5;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
height: 100vh;
margin: 0;
overflow: hidden; /* 防止按钮跑出屏幕产生滚动条 */
}
h1 {
color: #333;
margin-bottom: 50px;
z-index: 10;
}
#runaway-btn {
position: absolute;
padding: 15px 30px;
font-size: 18px;
font-weight: bold;
color: white;
background-color: #ff4d4f;
border: none;
border-radius: 8px;
cursor: pointer;
box-shadow: 0 4px 6px rgba(0,0,0,0.1);
transition: all 0.1s ease; /* 让移动看起来更平滑 */
}
#runaway-btn:hover {
background-color: #ff7875;
}
</style>
</head>
<body>
<h1>你的电脑已经中病毒了,点击下方按钮清除!😏</h1>
<button id="runaway-btn">点击清除病毒</button>
<script>
const button = document.getElementById('runaway-btn');
// 当鼠标移动到按钮上时触发
button.addEventListener('mouseover', function() {
// 获取浏览器窗口的宽高
const windowWidth = window.innerWidth;
const windowHeight = window.innerHeight;
// 获取按钮自身的宽高
const btnWidth = button.offsetWidth;
const btnHeight = button.offsetHeight;
// 计算随机的新坐标,确保按钮不会跑出屏幕边缘
const randomX = Math.floor(Math.random() * (windowWidth - btnWidth));
const randomY = Math.floor(Math.random() * (windowHeight - btnHeight));
// 更新按钮的位置
button.style.left = randomX + 'px';
button.style.top = randomY + 'px';
});
// 以防万一有人手速极快真的点到了
button.addEventListener('click', function() {
alert('居然被你点到了!不过这是骗你的,电脑好好的呢~ 🎉');
});
</script>
</body>
</html>