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

How to create sleep function

Status
Not open for further replies.

botatun

Programmer
Joined
Mar 7, 2006
Messages
40
Location
US
I'd like to put loop on hold until it resumed from frame.
I have a function that submit file update in unvisible frame:
-----------------------------------------------------------
var Used = false;

function sbmColumn(col)
{
for(var i=0; i < NumOfItm; i++)
{
var url = "EComItmSave.jsp?Cls=" + i;
waitUntillFreed();
window.frame1.location.href=url
Used = true;
}
}

function waitUntillFreed()
{
if(Used) setTimeout("waitUntillFreed()", 300);
}

function reuseFrame()
{
Used = false;
}
------------------------------------------------------
I want that waitUntillFreed() looping until Used is true
than continue to run FOR loop in sbmColumn().
The reuseFrame() will be started from frame1 on completion.
Is it possible to do?
 
try changing this:

Code:
if(Used) setTimeout("waitUntillFreed()", 300);

to this

Code:
while ( !Used ) {}

although, this may make your code hang [angel]



*cLFlaVA
----------------------------
[tt]( <P> <B>)13 * (<P> <.</B>)[/tt]

[URL unfurl="true"]http://www.coryarthus.com/[/url]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top