how to stop a javascript loop for a particular interval of time?

Posted by Harish on Stack Overflow See other posts from Stack Overflow or by Harish
Published on 2010-05-29T10:58:05Z Indexed on 2010/05/29 11:02 UTC
Read the original article Hit count: 211

Filed under:
|

i am using javascript for loop, to loop through a particular array and alert it's value. I want that after every alert it should stop for 30 seconds and then continue...till the end of loop. my code goes here..

    for(var i=0; i<valArray.lenght; i++)
    {
        alert("The value ="+valArray[i]);
        //stop for 30seconds..      
    }

i have used setTimeout() function, but it is not working...as loop end iterating but do not pause for 30seconds interval... is there any other way such as sleep function in PHP??

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about loops