简体   繁体   中英

How to load window.open('url') once only PHP & JQuery

My problem right now is the page is loading like a loop. it is popping pages non-stop , how can I load only once after i trigger the time <= 0 ? thank you.

here is what my code looks like.

<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>

I guess you forgot some {} 's and meant to write:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM