Handling Window.close event - urgent

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • sowmyap
    New Member
    • Sep 2006
    • 1

    Handling Window.close event - urgent

    Hi,

    My requirement is
    I have an asp page in which there is a textbox. If the user clicks on close(X) button in IE without entering a value in the textbox I want a pop up to appear like "Please enter the value" and the window should not close. Kindly advoice.

    I don't want the browser confirmation with Ok and cancel. B'coz if the user clicks on OK the window will close.

    regards,
    Sowmya
  • prasadsurya
    New Member
    • Mar 2007
    • 3

    #2
    Originally posted by sowmyap
    Hi,

    My requirement is
    I have an asp page in which there is a textbox. If the user clicks on close(X) button in IE without entering a value in the textbox I want a pop up to appear like "Please enter the value" and the window should not close. Kindly advoice.

    I don't want the browser confirmation with Ok and cancel. B'coz if the user clicks on OK the window will close.

    regards,
    Sowmya
    Here i am giving sample code
    <html>
    <head>
    <script type="text/javascript">
    var myclose = false;
    function ConfirmClose()
    {
    if (event.clientY < 0)
    {
    myclose = true;
    }
    }
    function HandleOnClose()
    {
    if (myclose==true)
    {
    window.open('ht tp://www.google.com' );
    }
    }
    </script>
    </HEAD>
    <body topmargin='0' bottommargin='0 ' leftmargin='20' rightmargin='20 ' onbeforeunload= "ConfirmClose() " onunload="Handl eOnClose()">
    </body>
    </html>

    Comment

    • ITA
      New Member
      • Jun 2007
      • 2

      #3
      Does anyone know why I get the blue underling error message saying "Event 'Closing' cannot be found" when I try to handle the closing event using Net 2.0 in VB? is there an imports that I have to do??


      Originally posted by prasadsurya
      Here i am giving sample code
      <html>
      <head>
      <script type="text/javascript">
      var myclose = false;
      function ConfirmClose()
      {
      if (event.clientY < 0)
      {
      myclose = true;
      }
      }
      function HandleOnClose()
      {
      if (myclose==true)
      {
      window.open('ht tp://www.google.com' );
      }
      }
      </script>
      </HEAD>
      <body topmargin='0' bottommargin='0 ' leftmargin='20' rightmargin='20 ' onbeforeunload= "ConfirmClose() " onunload="Handl eOnClose()">
      </body>
      </html>

      Comment

      Working...