faqts : Computers : Programming : Languages : JavaScript : Language Core : Functions

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

Entry

How do I call a function delayed AND pass an object along?

Mar 3rd, 2006 13:42
erik peterson, Techek,


Use an enclosure.  Basically, you will pass to setTimeout a function
which calls the function you need with the arguments you want.
passedObject = 'whatever variable I need to pass';
setTimeout(function() { myFunction(passedObject); }, 1000);
function myFunction(recievedObject) {
  //Do whatever
}