On 5/24/06, Jeremy Dunck <jdunck gmail.com> wrote:
> On 5/24/06, Premshree Pillai <premshree.pillai gmail.com> wrote:
> > On 5/24/06, Jonathan Buchanan
<jonathan.buchanan gmail.com> wrote:
> > var arr = new Array("foo",
"bar", "baz");
> > for (var i=0; i<arr.length; i++) {
> > window.setTimeout(
> > function(arg) { return function() {
alert(arg); }; }(arr[i]),
> > 1000
> > );
> > }
>
> Using GM 0.6.4 and FF 1.5.0.3, this does 3 alerts in
series (foo, bar,
> baz) for me.
>
> Did I misunderstand the expected behavior? Is this
exact code not
> working for you, or was this intended as a simplified
example?
What I'm hoping for is to call the anonymous function
within the loop
periodically -- every 5 seconds or so. So what I want is the
first
alert, followed by a pause (1000 ms, in this case), followed
by
another alert, and so on.
I'm definitely missing something. :/
Premshree
_______________________________________________
Greasemonkey mailing list
Greasemonkey mozdev.org
http:
//mozdev.org/mailman/listinfo/greasemonkey
|