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!

SetTimeOut 1

Status
Not open for further replies.
Nov 8, 2005
25
CA
Hi there

I have a function I need to delay, so normally I would do

call SetTimeOut(MyFunction(), 100)

to delay it. However MyFunction returns a value that I need. I don't know how to trap it.....

Any help?

Thanks
 
MyFunction() is executed in global context. You can make out a variable in global scope to hold the return value.
 
Hi tsuji

Sorry.. for being dumb... Can you give an example based on what I have above?

I tried
dim MyValue
MyValue = SetTimeOut(MyFunction(), 100)

It doesn't do it...

I tried
call SetTimeOut("MyValue = MyFunction()", 100)

It doesn't do it either....

Thanks

 
[tt]<html>
<head>
<script language="vbscript">
dim x : x=0
dim i : i=0
function myfunction()
x=100
i=i+1
end function

function mymonitor()
msgbox ("i=" & i & vbcrlf & "x=" & x)
end function

sub window_onload
setTimeout "myfunction()",1000
setTimeout "mymonitor()",2500
end sub
</script>
</head>
</html>
[/tt]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top