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 dencom on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Another question about SetTimeOut

Status
Not open for further replies.
Nov 8, 2005
25
CA
If I have a code like the following:

line 1
line 2
line 3
call window.SetTimeOut("MyFunction()", 1000)
line 4
line 5
line 6

Am I correct that while the system will wait 1000msec before executing MyFunction, lines 4 to 6 won't wait? I hope to actually delay lines 4 to 6 as well, but they're not really part of MyFunction().... am I therefore forced to include lines 4 to 6 in MyFunction() as well then?

Thanks
CC
 
They won't wait. To include or not include in the same function, it is up to designer to decide. The function MyFunction() is executed in the global context. Hence, that is something to take into account to write the function.
 
I asked whether to include lines 4 to 6 in MyFunction() or not because if I don't, then they will be executed before MyFunction finishes, which I don't want to see happen.

I want to make sure lines 4 to 6 are executed only after MyFunction returns a value.

Thanks
 
I have answered it. Then include them in the function as a plausible solution.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top