<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style>
div {
position: absolute;
width: 200px;
height: 200px;
left: 50%;
top: 50%;
margin-left: -304px;
margin-top: -217px;
text-align: center;
line-height: 200px;
font-size: 20px;
color: red;
display: none;
border: 1px solid yellow;
}
button {
position: absolute;
top: 0;
right: 0;
}
</style>
</head>
<body>
<div>我是一直弹出的广告
<button>X</button>
</div>
<script>
var div=document.querySelector('div')
var btn=document.querySelector('button')
setTimeout(function(){
div.style.display='block'
},2000)
btn.onclick=function(){
div.style.display='none'
setTimeout(function(){
div.style.display='block'
},2000)
}
</script>
</body>
</html>
烦人的广告弹窗
最新推荐文章于 2024-04-13 16:35:08 发布