[Greasemonkey] setTimeout() problems

A. Alfred Ayache alfred at lastbyte.ca
Wed May 24 10:28:53 EDT 2006


Hi Premshree:

I found a slideshow on DiveIntoGreasemonkey.org which explains how to do this:

http://diveintogreasemonkey.org/slides/

It's on slide 11, which you can get to by hovering in the lower right and using 
the drop-down.

 >>>
Can’t auto-eval chunks of JavaScript code in strings

Fails:

window.setTimeout("my_func()", 1000);

Works:

window.setTimeout(my_func, 1000);
<<<


A. Alfred Ayache
http://lphs76.ca             - Reunion community
http://www.rentersPlus.com   - Apartment Search
http://www.lastbyte.ca       - Web Design, eCommerce, PHP/MySQL, Java, Oracle


Premshree Pillai wrote:
> Hi group,
> 
> I'm using a setTimeout within a userscript. The function that I need
> to pass as argument accepts an argument. Sample code:
> 
>   var foo = "bleh";
>   window.setTimeout(function(arg) { alert(arg); }(foo), 300);
> 
> I get an error--"useless setTimeout call (missing quotes around
> argument?)"--on execution.
> 
> Any thoughts?
> 
> Premshree
> _______________________________________________
> Greasemonkey mailing list
> Greasemonkey at mozdev.org
> http://mozdev.org/mailman/listinfo/greasemonkey
> 
> --------------------------------
> Spam/Virus scanning by CanIt Pro
> 
> For more information see
> http://www.kgbinternet.com/SpamFilter.htm
> 
> To control your spam filter, log in at
> http://filter.kgbinternet.com
> 
> 


More information about the Greasemonkey mailing list