Form Submit not working on window.onbeforeunload
<p>Desperate to submit the form when the user navigates away using the links on the page. Clicking the link sets the saveOnUnload to true, the Save() functions is entered, alert happens, but neither form.Submit nor btnObj.click() actually work, i.e. the form submit is skipped!</p>

<pre><code>&lt;script language='javascript' type='text/javascript'&gt;
   function Save()
   {
      GetInputControl('hdnTimeOut').value = '2';
      var btnObj = GetInputControl("btnSave");
      alert (btnObj );
      btnObj.click();
      // document.aspnetForm.submit();
   }

   window.onbeforeunload = function (e)
   {
      if (saveOnUnload) Save();
   };
&lt;/script&gt;
</code></pre>
