+ 5
Why doesn't work
var decompte = 5; var timer = setInterval(function( ){ alert(decompte); decompte--; document.form.time.value = decompte; if (decompte <= 0) { clearInterval(timer); document.location.href = "http://google.fr"; } }, 1000); it's continue to alert (-1; -2) etc... why it doesn't go to google.fr ?
8 Respuestas
+ 5
var decompte = 5;
var timer=function(){
alert(decompte--);
if(decompte<=0)document.location.href="http://google.fr";
else setTimeout(timer,250);
};
timer();
then try this....?
But It work fine on me...=_=
+ 4
I think
window.location.href / location.href
+ 4
even with what you said it continue to alert 😢
+ 4
idk ! normally when decompte reached 0 it change the page.. but it continue to alert and substract 1 from decompte... so decompte-- = -1 etc...
+ 4
thanks, it work :)
+ 4
Ummmm It work fine on me but not on you
Problem in setInterval API on your device...?
Maybe na
Ahhhhh What's the main problem???
+ 4
i just 'copy text' of your answer and I didn't see vut I forgot to erase 'then try this...?' 😂
+ 3
But I doubt that how it count to -1,-2? 😕