Upon Link Click and setTimeout
<p>In JavaScript, I am trying to execute a function 2 seconds after a link is clicked, and wait until the function completes its execution before going to the link destination.</p>

<pre><code>/* JavaScript */
function myFunction() { /* Block of code, with no 'return false'. */ }

&lt;!-- HTML --&gt;
&lt;a onclick="setTimeout(myFunction, 2000);" href="http://www.siku-siku.com"&gt;Link&lt;/a&gt;
</code></pre>

<p>The problem is upon click, the browser immediately goes to the link destination i.e. <code>myFunction</code> didn't have time to execute. Did I miss anything here?</p>

<p>Thanks beforehand.</p>
