title: How can I control the action of onbeforeunload in IE?
body: <p>I've got a problem about <code>onbeforeunload</code> recently that I need to pop up a voting page when users try to close  their IE browsers.I did it by using:</p>
  
  <pre><code>&lt;body onbeforeunload="makevote()"&gt;
  </code></pre>
  
  <p>And the main structure of <code>makevote()</code> in javascript is as follows:</p>
  
  <pre><code>function makevote()
  {
      comet.distruct();
      if(csid != null &amp;&amp; isvote == null)
      {
          window.event.returnValue = false
          window.event.returnValue='press “cancel” to vote please！'
          showComDiv(popvote,"popiframe",400,120,'your vote here','dovote()');
      }
  
  }
  </code></pre>
  
  <p>In last three months this voting function performed so ugly that I got only less than 8,000 votes from  more than 4,50,000 vistors.I think the problem is, when the users try to close their browsers,the <code>onbeforeunload</code> property pops up a comfirm box which covered my voting box while most users click the OK button,which means close comfirming is done,as a habit.So my question is how can I control the comfirming box made by <code>onbeforeunload</code> myself? For example if I click the "OK" ,I'll go to the voting box instead of closing my IE.So far what I can do is only defining the message it shows.And is there any other better way to do this?Help would be greatly appreciated!</p>
  
  <p>Regards</p>