大神,帮忙看看,哪里有问题

来源:8-17 编程练习

qq_触掱钶忣倖福_0

2018-11-29 13:07

<!DOCTYPE html>
<html>
 <head>
  <title>浏览器对象</title>  
  <meta http-equiv="Content-Type" content="text/html; charset=gkb"/>   
 </head>
 <body>
  <!--先编写好网页布局-->
  <h1>操作成功</h1>
  <span id="sencond">5</span>
  <span>秒后回到主页</span>
 <a href="javascript:back()">返回</a>
  <script type="text/javascript">  
 
   //获取显示秒数的元素,通过定时器来更改秒数。
var num=document.getElementById("sencond").value;
function cound()
    {
        num--;
        document.getElementById("sencond").innerHTML=num;
        if(num==0)
            {
                location.assign("www.imooc.com");
            }
    }        
            setInterval("cound()",1000);
    
   //通过window的location和history对象来控制网页的跳转。
   function myback
    {
        window.history.back();
    }
 </script>
</body>
</html>

写回答 关注

1回答

  • 白色满天星星
    2019-06-06 16:32:19

    <!DOCTYPE html>

    <html>

     <head>

      <title>浏览器对象</title>  

      <meta http-equiv="Content-Type" content="text/html; charset=gkb"/>   

     </head>

     <body>

      <!--先编写好网页布局-->

     <div class="test">

        <p class="tips">操作成功</p>

        <p class="comeback"><span id="backtime">5</span>秒后回到主页<a href="#" onclick="GoBack()">返回</a>

        </p>

      </div>

      <script type="text/javascript">  

      

     

      <script type="text/javascript">  

     

       //获取显示秒数的元素,通过定时器来更改秒数。

    var a=5;

        function countDown(){

            document.getElementById("backtime").firstChild.nodeValue=a;

            a--;

            if(a==0){

                location.assign("https://www.imooc.com");

            }

        }

        var q =setInterval("countDown()",1000);

        function GoBack() {

            window.history.back();    

            }

       //通过window的location和history对象来控制网页的跳转。

       

     </script> 

    </body>

    </html>


JavaScript进阶篇

本课程从如何插入JS代码开始,带您进入网页动态交互世界

467393 学习 · 21877 问题

查看课程

相似问题