<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>广告案例</title>
<style>
img {
width: 300px;
height: 300px;
border: 1px solid red;
}
</style>
</head>
<body>
<div class="img">
<p>Welcome to my address home!</p>
<img src="./source/img/4e2ea71a70bc8253909306fff772c74.jpg" alt="">
<button class="btn">关闭</button>
</div>
<div class="img">
<img src="./source/img/4e2ea71a70bc8253909306fff772c74.jpg" alt="">
<button class="btn">关闭</button>
</div>
<div class="img">
<img src="./source/img/4e2ea71a70bc8253909306fff772c74.jpg" alt="">
<button class="btn">关闭</button>
</div>
<div class="img">
<img src="./source/img/4e2ea71a70bc8253909306fff772c74.jpg" alt="">
<button class="btn">关闭</button>
</div>
<script>
let close_btn = document.querySelectorAll(".btn");
for (let i = 0; i < close_btn.length; i++) {
close_btn[i].addEventListener('click', function () {
this.parentNode.style.display='none';
})
}</script>
<!--<script src="source/ad.js"></script>-->
</body>
</html>