javascript - I would like to call setinterval, and when set interval completes, change the page -
i use set interval, , when interval completes, change page - however, below, changes page after 1 interval run when want to change page when mynumber >= 300.
i'd grateful of help, thanks
var mynumber = 0; function openportal() { var myinterval = window.setinterval(myzoom,2); document.location.href ="http://next page"; } function myzoom () { if(mynumber>=300){ clearinterval(myinterval); } mynumber++; }
the problem calling document.location.href ="http://next page";
in openportal
method, set interval , redirect page new location.
var mynumber = 0, myinterval; function openportal() { myinterval = window.setinterval(myzoom,2); } function myzoom () { if(mynumber>=300){ clearinterval(myinterval) document.location.href ="http://next page"; } mynumber++; }
Comments
Post a Comment