如何只加载一次PHP和JQuery的window.open('url')

问题描述 投票:3回答:1

我现在的问题是页面像循环一样加载。它是不停弹出的页面,如何在触发时间<= 0后才加载一次?谢谢。

这是我的代码的样子。

<script type="text/javascript">
  var timeleft = 10;
  var downloadTimer = setInterval(function(){
  document.getElementById("progressBar").value = 10 - timeleft;
  timeleft -= 1;

if(timeleft <= 0)

    clearInterval(downloadTimer);
    window.open("http://localhost/ppa/movies.php", "", "width=1500px,height=1000px",true);
  }, 1000);

</script>
javascript php jquery html
1个回答
4
投票

我想你忘记了一些{}的意思并写作:

{
    ...
    if (timeleft <= 0) {
        clearInterval(downloadTimer);
        window.open("http://localhost/ppa/movies.php", "",
                    "width=1500px,height=1000px",true);
    }
}, 1000);
© www.soinside.com 2019 - 2024. All rights reserved.