By clicking on cancel in confirm box close my parent window . I want that on cancel it should be on same page
<p>Clicking on cancel in confirm box closes my parent window. I want that on cancel it should stay on same page. I have written the following code for it.</p>

<pre><code>function closeEditorWarning(){
    var r=confirm("This will close all the opened windows of application.Do you want to continue.");
    if (r==true)
    {   
         for (var i=0;i&lt;childWindow.length;i++) {
                if (childWindow[i] &amp;&amp; !childWindow[i].closed)
                    childWindow[i].close();
              }
         self.close();
         }
   else
      {
      }
}
window.onbeforeunload = closeEditorWarning;
</code></pre>
