You are here: irt.org | BBS | Re: loops in Javascript? [This BBS is closed]
Posted by Martin Webb on June 16, 1998 at 07:18:59:
In Reply to: Re: loops in Javascript? posted by oz on June 16, 1998 at 05:37:48:
: but doesn't that mean that the 'delay' value is going to decide how far the page scrolls?
No the delay parameter decides the interval before the scroll_function is invoked.
: also the main prob I've been having is detecting mouseOut once the loop starts.......
setTimeout does not cause a loop, it sets a timer which triggers some JavaScript code after a delay. A setTimeout doesn't stop the rest of the code from being processed. The code execution continues in sequential order.
: are you saying it is impossible to do true loops in JS???
No. You can have a loop. The trouble with a loop is that nothing else can happen whilst JavaScript is looping. Heres an empty loop:
for (var i = 0; i > 1000; i++) { }
: the idea is to scroll the main frame when the mouseOver event occurs on the direction arrows.
: My idea was to place a loop between the mouseOver and mouseOut events that calls the scroll function of the main frame,
: but I can't seem to stop the the loop once I start it. Is it possible to have a loop in JS?
Why are you placing a loop between two separate event handlers? What is the purpose of the loop?
Follow-ups:
You are here: irt.org | BBS | Re: loops in Javascript? [This BBS is closed]