Results 1 to 11 of 11

Thread: Close Window

  1. #1
    Join Date
    Aug 2003
    Posts
    9

    Arrow Unanswered: Close Window

    Hello everyone,

    If i have a page(page 1) and from this page i open e new page (page2), how can i force the viewing of the page1 again when i close page 2??

    Thank you for your help.

    Regards,

  2. #2
    Join Date
    Jun 2003
    Posts
    9
    maybe use a redirect ?
    It matters how you are closing page 2, if you are closing it with a button, you can use :

    If request ("submit") = "close window" then
    Response.Redirect "../Forms/page1.asp"
    End If

  3. #3
    Join Date
    Aug 2003
    Posts
    9

    Arrow Close Window

    Originally posted by andy_cfc
    maybe use a redirect ?
    It matters how you are closing page 2, if you are closing it with a button, you can use :

    If request ("submit") = "close window" then
    Response.Redirect "../Forms/page1.asp"
    End If
    I dont't want using the redirect.

    I want forcing show the page1, before closing the page2.

  4. #4
    Join Date
    Jul 2003
    Location
    SoCal
    Posts
    721
    Are you simply looking to bring the first window into focus when the second window is closed?

  5. #5
    Join Date
    Aug 2003
    Posts
    9

    Close Window

    Originally posted by Seppuku
    Are you simply looking to bring the first window into focus when the second window is closed?

    Yes...


    Thank you for response.

  6. #6
    Join Date
    Jul 2003
    Location
    SoCal
    Posts
    721
    This wouldn't be done in ASP then.. you'd do it in JavaScript.

    Add to your BODY tag of the child window: onUnload="window.opener.focus();"

  7. #7
    Join Date
    Aug 2003
    Posts
    9

    Close Window

    Originally posted by Seppuku
    Are you simply looking to bring the first window into focus when the second window is closed?

    Yes...


    Thank you for response.

  8. #8
    Join Date
    Aug 2003
    Posts
    9

    Thumbs up Thank you...

    Thank you...

    Perfect!!!!

    Regards

  9. #9
    Join Date
    Aug 2003
    Posts
    9

    Arrow Close Window

    Body , perfect!!!


    But, in link no functional.

    The code close the window, press the link.

    <a onClick="window.close()" onUnload="window.opener.focus()">

    I want openning the page father, after close the page children.

  10. #10
    Join Date
    Jul 2003
    Location
    SoCal
    Posts
    721

    Re: Close Window

    Originally posted by sdpeixoto
    Body , perfect!!!


    But, in link no functional.

    The code close the window, press the link.

    <a onClick="window.close()" onUnload="window.opener.focus()">

    I want openning the page father, after close the page children.
    I'm a little lost. I'm not sure what you mean by this. The "onUnload" event handler is only used in the BODY tag. It cannot be used in an A tag. To make your A tag close the window and focus the parent, it'd look like this:

    Code:
    <html>
    <head>
        <title>This is the child window</title>
    </head>
    <body onUnload="window.opener.focus();">
    <a href="javascript:window.close();">Close Window</a>
    </body>
    </html>
    That would close the child window and focus the parent window.

  11. #11
    Join Date
    Jul 2003
    Location
    Ohio/Chicago
    Posts
    75
    in short no matter how you close the window (link, button, x button in window) the body onunload will always work the same way. As in focusing on the other window in this case.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •