欢迎来到Java学习网!
设为首页 | 加入收藏
当前位置: 首页 > Java语言 > JavaScript >
404页面停留指定秒数后跳转到网站首页

<div>
<span class="times"><span id="time">7</span> 秒后</span>
<script src="http://www.qq.com/404/search_children.js" type="text/javascript" charset="utf-8"></script>
</div>

<script language="javascript">
   var oTime=document.getElementById('time');
   var oSecs=7;
   function time()
      {
        oSecs --;
         if (oSecs < 0)
         {
            clearInterval();
            return;
         }
        
         if (oSecs == 0)
         {
            clearInterval();
            window.location.href = 'http://www.javaweb.cc';
            //alert(1)
         }
         oTime.innerHTML = oSecs;
      }
   setInterval(time,1000)
</script>
    相关教程
    推荐内容