title: window.location.href not working in form onsubmit
body: <p>So i have a form, and <code>onsubmit="return reg_check(this)"</code> where <code>reg_check()</code> is a javascript function in the header which is supposed to check the form data, and since one of its tasks is to check if the username is in the database which requires php, i want to redirect to a php page that does this task. </p>
  
  <p>Problem is: <code>window.location.href</code> is not working! Here's the function (reduced version) and of course the <code>main.php</code> is just a random page i got: </p>
  
  <pre><code>function reg_check(myForm) {
      alert("before redirect..");
      window.location.href = "http://localhost/main.php?width=" + screen.width + "&amp;height=" + screen.height;
      alert("after redirect..");
  }
  </code></pre>
  
  <p>The <code>before redirect</code> and <code>after redirect</code> alerts work, it just doesn't redirect? It remains in the same page.</p>
  
  <p>Also, if I tried to redirect from the body by just typing :</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
      alert("before redirect..");
      window.location.href = "http://localhost/main.php?width=" + screen.width + "&amp;height=" + screen.height;
      alert("after redirect..");
  &lt;/script&gt;
  </code></pre>
  
  <p>it redirects.</p>
  
  <p>Any ideas of how I could get this to work? </p>