title: Onload function not working for a href
body: <p>I have a script:</p>
  
  <pre><code>&lt;script&gt;
  function load_thankyou()
  {
      alert('hii');
      var delay = 1000; //Your delay in milliseconds
      var URL = 'thankyou.php';
      setTimeout(function()
                  { 
                    window.location = URL; 
                  }, delay);
  }
  &lt;/script&gt;
  </code></pre>
  
  <p>The function is called in the following manner...</p>
  
  <pre><code>&lt;?php
      if ($_SERVER['REQUEST_METHOD'] == 'POST') 
      {
          if($error_flag == 0)
          {?&gt;
  
      &lt;a class="close" href="#" onload="load_thankyou()"&gt;×&lt;/a&gt;
  &lt;?php
          }
      }?&gt;
  </code></pre>
  
  <p>But it seems, somehow the onload() function is not working..</p>