title: Creating a delay in for-loop iterations
body: <p>I've written the following function with hopes to add 1px onto the top margin to animate a window sliding out of the page.</p>
  
  <p>Currently it works fine and removes the window from the page, However I'm having problems creating the delay interval in each iteration of the for loop. I've thought about using <code>setTimeout()</code>, but with this I cant just break; the for loop I have to call a function,</p>
  
  <p>Any ideas? </p>
  
  <pre><code>function slideOut() {
      var obj = document.getElementById("cInstructs");
      var orig = 66;
      for(i=0; i&lt;2000; i++) {
          orig++;
          obj.style.marginTop = orig+"px";
          }
      };
  </code></pre>
  
  <p>Thanks in advance!</p>