Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

setTimeout and passing variables

Status
Not open for further replies.

aenik

Programmer
Aug 22, 2002
7
US
Hello.
I am trying to set a timeout for a portion of my code that is inside of a for() loop, and the function receives a variable thats known to the function within which the for() loop takes place, a global (to that function) var array:
setTimeout("updateTag(getDirList(),'jpg',0,'../display/'+arr[cell]);",10000);
however i get an error, saying the array 'arr' is undefined. Not sure if setTimeout can receive variables.. if so, what am i doing wrong? if i bring the function call outside the setTimeout, it works, so my function call cant have a mistake. thanks.
 
It's possible that what is gettig lost is your cell refeernce, rather than the array, perhaps if you build the entire string into a string variable ahead of time than setTimeout that pre-built string you will have better luck.
-Tarwn ------------ My Little Dictionary ---------
Reverse Engineering - The expensive solution to not paying for proper documentation
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top