zoukankan      html  css  js  c++  java
  • 5秒钟之后跳转页面

    <!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>
        <button>点击</button>
        <div></div>
        <script>
            var btn = document.querySelector('button');
            var div = document.querySelector('div');
            btn.addEventListener('click', function() {
                // console.log(location.href);
                location.href = 'http://www.itcast.cn';
            })
            var timer = 5;
            setInterval(function() {
                if (timer == 0) {
                    location.href = 'http://www.itcast.cn';
                } else {
                    div.innerHTML = '您将在' + timer + '秒钟之后跳转到首页';
                    timer--;
                }

            }, 1000);
        </script>
    </body>

    </html>
  • 相关阅读:
    Linux下新建服务
    查看MYSQL日志(包含最近锁表日志)
    Linux后台运行进程
    MYSQL分析慢查询
    Linux下打开超大文件方法
    通过文件列表打包文件
    linux学习笔记<基本知识普及>
    虚拟机的安装
    Android NDK编程,引入第三方.so库
    linux下软件安装与卸载
  • 原文地址:https://www.cnblogs.com/yanlei369343/p/13928621.html
Copyright © 2011-2022 走看看