zoukankan      html  css  js  c++  java
  • javascript倒计时调转页面

    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312"/>
    <title>JavaScript控制页面5秒后自动跳转的代码</title>
    <script type="text/javascript">
    function countDown(secs,surl){
    //alert(surl);
    var jumpTo = document.getElementById('jumpTo');
    jumpTo.innerHTML=secs;
    if(--secs>0){
    setTimeout("countDown("+secs+",'"+surl+"')",1000);
    }
    else
    {
    location.href=surl;
    }
    }
    </script>
    </head>
    <body><span id="jumpTo">5</span>秒后自动跳转到http://www.jb51.net/
    <script type="text/javascript">
    countDown(5,'http://www.jb51.net/');
    </script>
    </body>
    </html>

    欢迎点评,共同学习,共同进步
  • 相关阅读:
    ASP.NET 篇
    .NET Core 篇
    JS-CSS篇
    IIS使用篇
    WebService篇
    电脑使用篇
    数据库使用篇
    正则表达式篇
    Linux学习篇
    Leetcode 198. 打家劫舍 dp
  • 原文地址:https://www.cnblogs.com/start-fxw/p/4531266.html
Copyright © 2011-2022 走看看