zoukankan      html  css  js  c++  java
  • JS 跳转页面

    编程练习

    制作一个跳转提示页面:

    要求:

    1. 如果打开该页面后,如果不做任何操作则5秒后自动跳转到一个新的地址,如慕课网主页。

    2. 如果点击“返回”按钮则返回前一个页面。

    <!DOCTYPE html>
    <html>
    <head>
         <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
          <title></title>  
    </head>
    <body>
          <!--先编写好网页布局-->
          <h4>操作成功</h4>
        <p><span id="str">5</span>秒后回到主页&nbsp;<a href="">返回</a></p>
     
          <script type="text/javascript">  
            var h=document.getElementById('str');
            var i=5;
            var time=setInterval(function () {
                i--;
                str.innerHTML=i;
                if(i==1){
                    window.location.href="https://www.imooc.com/code/1633";
                }
            },1000);
       //获取显示秒数的元素,通过定时器来更改秒数。
               function goback(){
                   history.go(-1);
               }
       //通过window的location和history对象来控制网页的跳转。
       
     </script> 
    </body>
    </html>
  • 相关阅读:
    Shell脚本编程之Shell函数
    Shell脚本编程之流程控制
    Shell脚本编程之Shell命令
    MySQL5.6的optimizer_trace
    Cgroup
    Python的__main__.py用法
    Git提交到github上
    mysql timeout
    数据库大牛
    update and的坑
  • 原文地址:https://www.cnblogs.com/huaspsw/p/10016949.html
Copyright © 2011-2022 走看看