页面几秒后跳转某一个网址代码

时间:2025-06-28 16:01:41  阅读量:  分类:标签:
<!DOCTYPE html>
<html>
<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>
    <div></div>
    <script>
        var div = document.querySelector('div');
        var time = 10;
        timer();
        setInterval(timer, 1000)
        function timer() {
            if (time == 0) {
                location.href = 'https://mp.weixin.qq.com/s?__biz=MzA3MjE3NTg0OA==&mid=2511064150&idx=1&sn=dd12b2f6f26984f76f08b59326afc8a4&chksm=8f7d35d1b80abcc7fb17c34da0e5f3e2f022bfedd426ce25a85eb70cbddcea28107ccf9a2d7f&payreadticket=HMKOdxwuJvCO-clwyqu_LbVS97sI4PtALBxoamgqtMohv_pJRUGLhJIw3JGqMRc1yvbWXms#rd'
            } else {
                div.innerHTML = '将在' + time + '秒后跳转到付费链接<br>';
                time--;
            }
        }
    </script>
<div style="text-align: center;"><strong><span style="font-size:18px;"><span style="color:#FF0000;">还有三秒跳转付费链接</span></span></strong></div>
<img alt="" src="/d/file/p/2023/03/1ec86e0a230af1206ce7b9c8e990b888.jpg" style="height: 60%; width: 100%;" />

</body>

</html>