问答详情
源自:8-17 编程练习

简单搞定了

 <div>

    <span id="time">5</span>

    <span>秒后返回主页</span>

    <a href="" onclick="go()">返回</a>

   </div>

<script>

     function go(){

         history.go(-1);

         }

           var num=5;

     function jishi(){

         document.getElementById("time").innerText=num;

         if(num==0){

         window.open("https://www.baidu.com",'_blank','width:600','height:400');

         clearInterval(insd);

         }else{

         num=num-1;

         }

         }

         var insd=setInterval("jishi()",1000);

</script>


提问者:qq_幸福愛努力_0 2024-03-11 11:55

个回答