Wait for page to load before continue

View: New views
1 Messages — Rating Filter:   Alert me  

Wait for page to load before continue

by CaseyD :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I have a script that changes to a new link in a loop using "window.location.href = url".  The script needs to do this many times (about 25 times).  But, I need for the script to pause after each time before the script continues.

If I put in a delay by using "alert("pause")" in the loop, every thing works fine.  How do I tell the script to wait until "url" has finished loading?

This is not my exact code, but is what I am trying to do:

for (i=0;i<x.length;i++)
{
  window.location.href = "http://www.abcxyz.com/page_" + x;
}

Thanks!