You probably shouldn't use 'int'. It may be a reserved word in Javascript. I suggest using a different variable name to be safe.
On Aug 21, 11:01 am, solow <solow.wes...@gmail.com> wrote: > Hey, > > I have a question. > > I want to create a javascript loop, with setInterval(). > This loop has to be used in dynamicaly loaded content, which should be > reloaded every x seconds. This works fine. > > But now, I want to use clearInterval to STOP the interval, when I > leave the dynalically loaded page. Because if I don't, the loop will > keep on running, even when not on that page. So, how do I do this? I > even tried the easiest way, setting a button in the dynamically loaded > content: > > <button onclick="int=window.clearInterval(int)"> > Stop interval</button> > > but this doesn't even work... > > basically, what i want, is to clear all intervals, on a certain div, > when i navigate somehwere else. > > To prevent any confusion, the 'navigate somewhere else' means, other > dynamically content. the page doesn't refresh ever. > > Hope someone can help me. > > Wesley.