title: javascript: window.close(); after X amount of seconds
body: <p>I have a pop-up with an onclick action to close the box when the submit button is pressed:</p>
  
  <pre><code>&lt;input type="submit" name="submit" value="submit" onclick="javascript: window.close();"&gt;
  </code></pre>
  
  <p>I'm trying to adapt it to wait 3 seconds after the submit button is clicked to close.</p>
  
  <p>I read an article that suggested using this in the :</p>
  
  <pre><code>&lt;script&gt; 
  setTimeout("window.close()",3000) 
  &lt;/script&gt;
  </code></pre>
  
  <p>but it closes the pop-up after 3 seconds regardless of whether or not the button is clicked.</p>
  
  <p>How can I adapt it to work with the button?</p>