Confirm message with javascript returns error
<p>I have problem with confirm message....
When I clicked the browser close button it shows confirm message with OK and CLOSE button....</p>

<p>When I click ok button the browser get closed... If I click cancel it need to stay on the page...But when I click cancel button the browser get closed....</p>

<p>MY CODE IS HERE</p>

<pre><code> function doUnload() {
     if (!isClose) {
         var agree = confirm('Are you sure to close the window?');
         if (agree == true) {
              return true;
         }
         else {
              return false;
         }
     }
 }
</code></pre>

<p>Please give me the solution.</p>
