title: How to stop a page from loading with JavaScript
body: <p>I have a Button with PostBackUrl.
  Also I have assigned a function to its onclientclick method in which some page logic were written including a couple of validation rules.
  if whole page were not valid this method returns False but I can not stop page. I have tried document.execCommand('Close') and Window.Stop() but no success.</p>
  
  <p>Any suggestions?</p>
  
  <p>Edit:
  Button:</p>
  
  <pre><code>&lt;asp:Button ID="btnSubmit" runat="server" OnClientClick="return DoLogic()"  PostBackUrl="http://google.com" Class="btn_submit"/&gt;
  </code></pre>
  
  <p>DoLogic:</p>
  
  <pre><code>function DoLogic() {
  
  if (ValidateForm()) {
  blah blah blah
  return true;
  }
  else {
  alert("Has Error");
  return false;
  }
  </code></pre>
  
  <p>ValidateForm:</p>
  
  <pre><code>function ValidateForm(){
  if (haserror)  
  {  
  return false; 
  } 
  return true; 
  }
  </code></pre>