跳转成功的页面

<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <title></title>
        <style type="text/css">
            body{
                text-align: center;
            }
        </style>
        <script type="text/javascript">
            window.onload = function(){
                 var res = document.getElementById("btn01");
                 var p = document.getElementsByTagName("p")[0];
                 res.onclick = function(){
                      //window.open("0110秒倒数计.html","_self");
                      window.location.href = "0110秒倒数计.html";
                 }
                var num = 10;
                var timer = setInterval(function(){
                    p.innerText = num+"秒后返回主页";
                    num--;
                    if(num<0){
                        window.open("0110秒倒数计.html","_self");
                        clearInterval(timer);
                    }
                },1000)
                
            }
        </script>
    </head>
    <body>
        <h2>恭喜您,支付成功</h2>
        <p>10秒后返回主页</p>
        <button id="btn01" type="button">立即返回</button>
    </body>
</html>

 

posted @ 2022-02-25 17:02  st-159  阅读(31)  评论(0)    收藏  举报