定时关闭广告2020/11/24

setTimeout(function() {
ad.style.display = ‘none’
}, 2000)

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>

<body>
    <img src="images/ad.jpg" alt="" class="ad">
    <script>
        var ad = document.querySelector('.ad');
        setTimeout(function() {
            ad.style.display = 'none';
        }, 5000);
    </script>
</body>

</html>

版权声明:本文为weixin_50286102原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。