Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > JavaScript > setTimeout() sy...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 7 Topic 35491 of 36380
Post > Topic >>

setTimeout() syntax

by Steve <stephen.joung@[EMAIL PROTECTED] > May 6, 2008 at 01:14 AM

I have noticed that setTimeout works if the brackets () are left off
the function called, like this:

window.setTimeout(myFunction, 1000);

I thought that the brackets were required to show that myFunction is a
function, so why are they not required here?

Also I have found that if I want to pass a value to a function with
setTimeout I need to enclose the function in inverted commas, like
this;

window.setTimeout("myFunction(10)", 1000);

Why are the inverted comma's required here but not in the example
above?

I realize that these questions will be self explanatory to some of you
but I cannot find the answers even in the Rhino book. So friendly and
useful answers only please :-)
 




 7 Posts in Topic:
setTimeout() syntax
Steve <stephen.joung@[  2008-05-06 01:14:38 
Re: setTimeout() syntax
"P. Prikryl" &l  2008-05-06 02:41:36 
Re: setTimeout() syntax
Steve <stephen.joung@[  2008-05-06 03:58:32 
Re: setTimeout() syntax
Tuomo Tanskanen <tumi_  2008-05-06 14:08:57 
Re: setTimeout() syntax
Henry <rcornford@[EMAI  2008-05-06 04:33:04 
Re: setTimeout() syntax
Tuomo Tanskanen <tumi_  2008-05-06 14:46:02 
Re: setTimeout() syntax
Steve <stephen.joung@[  2008-05-06 04:46:22 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Fri Jul 25 23:30:05 CDT 2008.