At the beginning of the function, you first need to stop setInterval qweqwe, and then start.

Now it only stops, but it does not start ...

function qweqwe() { clearInterval(qweqwe); qweqwe = setInterval(function() { ... }, 100); } 

    2 answers 2

     function qweqwe() { clearInterval(qweqwe); qweqwe = setInterval(function() { alert(1); }, 1000); } qweqwe(); 

    Everything works great :-)

       var handle; function qweqwe() { clearInterval(handle); handle = setInterval(function() { ... }, 100); } qweqwe();