zoukankan      html  css  js  c++  java
  • 通过 JS 实现错误页面在指定的时间跳到主页

    通过 JS 实现错误页面在指定的时间跳到主页

    <!DOCTYPE html>
    <html>
    
    <head>
        <title>浏览器对象</title>
        <!-- 通过 JS 实现错误页面在指定的时间跳到主页 -->
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type"/>
    </head>
    
    <body>
    <!-- 先编写好网页布局 -->
    <h3>操作成功</h3>
    <p><b id="second">5</b>秒后回到主页<a href="javascript:goBack();">返回</a></p>
    <script type="text/javascript">
        // 获取显示秒数的元素,通过定时器来更改秒数。
        var sec = document.getElementById("second");
        var i = 5;
        var timer = setInterval(function () {
                i--;
                sec.innerHTML = i;
                if (i === 1) {
                    window.location.href = "http://baidu.com";
                }
            },
            1000);
    
        // 通过 window 的 location 和 history 对象来控制网页的跳转。
        function goBack() {
            window.history.go(-1);
        }
    </script>
    </body>
    
    </html>
    
  • 相关阅读:
    note
    deep learning
    matlab远程调试
    faster rcnn
    十一旅行
    python生成随机数
    python 读取mat文件
    opencv anaconda
    python文件操作
    python换行
  • 原文地址:https://www.cnblogs.com/hgnulb/p/9693751.html
Copyright © 2011-2022 走看看