简单的JS代码实现秒数跳转到指定网站

使用方法:

将下面的代码合理运用到自己的网页中,将代码中的地址修改为自己的即可,还可以修改跳转时间,代码中都有备注修改方法。

代码

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF8">
    <meta name="viewport" content="width=devicewidth, initialscale=1.0">
    <title>JS实现自动跳转网址</title>
    <script>
        function autoRedirect() {
            setTimeout(function() {
                window.location.href = "https://www.aayuanma.cn"; // 将此处的网址替换为你想要跳转的网址
            }, 5000);//5000代表5秒后跳转
        }
    </script>
</head>
<body onload="autoRedirect()">
    <h1>AA源码网-跳转页面</h1>
    <p>页面将在5秒后跳转</p>
</body>
</html>

© 版权声明
THE END
喜欢就支持一下吧
点赞8 分享
评论 抢沙发

请登录后发表评论

    暂无评论内容