...

View Full Version : Making loop to stop for a while



saldikey
06-24-2002, 07:17 AM
Hi!
Is it possible to make loop wait on each step?

I tried to use setTimeout - its not working
I tried to use break - its let me do loop only once, than I made it nested loop - no visible pause

Please, I just dont wanna give up. :confused:

saldikey
06-24-2002, 03:27 PM
for (condition)
{
document.write(Something)
/*I want it make stop here*/
}


Thank you

nolachrymose
06-24-2002, 05:08 PM
var interval=setInterval(writeStuff,1500);
var i=0;
var thingsToWrite=["hello","how are you?","fine","you?","fine","good","bye"]; //it's a time like this I wish there was the qw "thingy" in JS!

function writeStuff() {
document.writeln(thingsToWrite[i]+"<br/>");
i++;
if(i==thingsToWrite.length)
clearInterval(interval);
}

Hope that helps!

Happy coding! :)

tamienne
06-24-2002, 05:26 PM
This gives a pretty good explanation.


http://www.faqts.com/knowledge_base/view.phtml/aid/1602/fid/143

saldikey
06-24-2002, 08:24 PM
It works now, but only at IE
not NS, but I will do something about it :)

You can take a look at this "stop" here:
http://fatweb.info



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum