Files
ClassContent/历届学生/front-end-team-10/项目练习/学生项目/薛涛/2.24/关闭广告.html
2024-09-27 02:06:13 +08:00

64 lines
1.2 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style>
* {
margin: 0;
padding: 0;
}
body {
height: 3000px;
}
.gg {
width: 200px;
height: 200px;
background: red;
position: fixed;
right: 0;
bottom: 0;
}
.gg span {
position: absolute;
right: 10px;
top: 10px;
cursor: pointer;
}
</style>
</head>
<body>
<div class="gg">
<span> X </span>
</div>
</body>
<script>
//点三次关闭广告
//第一次打开网页 第二次没反应 第三次关闭广告
var colse = document.querySelector(".gg span"),
gg = document.querySelector(".gg"),
nums = 0
colse.onclick = () => {
nums += 1;
if (nums == 1) {
open('https://fanyi.baidu.com/')
}
// if (nums == 2) {
// }
if (nums == 3) {
gg.style.display='none'
}
}
</script>
</html>