title: Auto submit form after 5 seconds
body: <p>I have a form that i am trying to submit after the page loads and 5 seconds has gone passed.. i have tried setTimeout but it doesnt appear to be working.. can anyone suggest why this would be the case, i have jQuery on the site but couldnt get delay() working either</p>
  
  <pre><code>&lt;form action="" name="cartCheckout" id="cartCheckout" method="post"&gt; 
  &lt;input type="hidden" name="action" value="checkout" /&gt;
  &lt;input type="hidden" name="save" value="1" /&gt;
  &lt;input type="hidden" name="orderID" value="&lt;?php echo $GLOBALS['CHECKOUT_ORDERID']; ?&gt;" /&gt;
  
  &lt;div class="itembox" id="step4box"&gt;
      &lt;div id="progress"&gt;
          &lt;ul&gt;
          &lt;li&gt;Your Cart&lt;/li&gt;
          &lt;li&gt;Your Details&lt;/li&gt;
          &lt;li class="current"&gt;Payment&lt;/li&gt;
          &lt;li&gt;Confirmation&lt;/li&gt;
          &lt;/ul&gt;
      &lt;/div&gt;
  &lt;div id="words" class="gothbold"&gt;Please wait while we we redirect you to&lt;br /&gt;Paypal for a secure payment method.&lt;/div&gt;
  
  &lt;a class="redirect" href="javascript:void(0)" title="Proceed to Paypal" onClick="document.cartCheckout.submit();"&gt;&lt;span&gt;If you aren't redirected in 5 seconds click here&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;
  
  &lt;a class="cancel" href="javascript:void(0)" title="Return to details" onClick="jQuery('#step4box').hide();jQuery('#step2box').show();"&gt;&lt;span&gt;Cancel&lt;/span&gt;&lt;/a&gt;    
  &lt;/div&gt; 
  &lt;script type="text/javascript"&gt;
      window.onload=function(){ 
          window.setTimeout(document.cartCheckout.submit(), 5000);
      };
  &lt;/script&gt;
  &lt;/form&gt;     
  </code></pre>
  
  <p>any help would be greatly appreciated, thanks in advance</p>
  
  <p>EDIT:</p>
  
  <p>changed to this via a combination of @Alex, @user824294 and this question: <a href="https://stackoverflow.com/questions/3089475/how-can-i-create-a-5-second-countdown-timer-with-jquery-that-ends-with-a-login-p">How Can I create A 5 second Countdown timer with jquery that ends with a login popup?</a>. Now working great and with great functionality of a countdown. Thanks guys!</p>
  
  <pre><code>window.onload=function(){ 
      var counter = 5;
      var interval = setInterval(function() {
          counter--;
          $("#seconds").text(counter);
          if (counter == 0) {
              redirect();
              clearInterval(interval);
          }
      }, 1000);
  
  };
  
  function redirect() {
      document.checkout_paypal.submit();
  }
  </code></pre>