Teil von SELFHTML Forum Teil von SELFHTML Forumsarchiv Teil von 2005 Teil von August

SELFHTML Forumsarchiv
setInterval clearInterval

Informationsseite
  1. Seite (JAVASCRIPT) setInterval clearInterval von inSide-j00ls, 31. 08. 2005, 14:29
nach unten

setInterval clearInterval

Die folgende Nachricht zum Thema stammt von: inSide-j00ls, 31. 08. 2005, 14:29

I have the following function that starts downward scrolling:

function NachUnten (mausaufbild) {
var aktiv = window.setInterval("window.scrollBy(0, +10)", 50);}

this works nicely - but calling a second function with clearInterval(aktiv); does not work - only calling clear at the same time cancels the scrolling process but then I cant scroll at all - even if I call the same function with a variable that decides whether or not to call clearInterval it never works. How can I reference the interval once I have started it ?

Help much appreciated!

nach obennach unten

setInterval clearInterval

Die folgende Nachricht zum Thema stammt von: Struppi, 31. 08. 2005, 14:37

»» function NachUnten (mausaufbild) {
»» var aktiv = window.setInterval("window.scrollBy(0, +10)", 50);}
»»
»» this works nicely - but calling a second function with clearInterval(aktiv); does not work - only calling clear at the same time cancels the scrolling process but then I cant scroll at all - even if I call the same function with a variable that decides whether or not to call clearInterval it never works. How can I reference the interval once I have started it ?

you must declare "aktiv" global. Just remove var

Struppi.
--
Javascript ist toll

nach oben
Teil von SELFHTML Forum Teil von SELFHTML Forumsarchiv Teil von 2005 Teil von August

© 1998-2006 Seite Impressum, Software: Classic Forum