If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > ASP > Close Window

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 08-21-03, 03:50
sdpeixoto sdpeixoto is offline
Registered User
 
Join Date: Aug 2003
Posts: 9
Arrow 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,
Reply With Quote
  #2 (permalink)  
Old 08-21-03, 05:37
andy_cfc andy_cfc is offline
Registered User
 
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
Reply With Quote
  #3 (permalink)  
Old 08-21-03, 05:41
sdpeixoto sdpeixoto is offline
Registered User
 
Join Date: Aug 2003
Posts: 9
Arrow Close Window

Quote:
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.
Reply With Quote
  #4 (permalink)  
Old 08-21-03, 10:48
Seppuku Seppuku is offline
Useless...
 
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?
Reply With Quote
  #5 (permalink)  
Old 08-21-03, 13:24
sdpeixoto sdpeixoto is offline
Registered User
 
Join Date: Aug 2003
Posts: 9
Close Window

Quote:
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.
Reply With Quote
  #6 (permalink)  
Old 08-21-03, 14:26
Seppuku Seppuku is offline
Useless...
 
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();"
Reply With Quote
  #7 (permalink)  
Old 08-21-03, 14:41
sdpeixoto sdpeixoto is offline
Registered User
 
Join Date: Aug 2003
Posts: 9
Close Window

Quote:
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.
Reply With Quote
  #8 (permalink)  
Old 08-21-03, 14:51
sdpeixoto sdpeixoto is offline
Registered User
 
Join Date: Aug 2003
Posts: 9
Thumbs up Thank you...

Thank you...

Perfect!!!!

Regards
Reply With Quote
  #9 (permalink)  
Old 08-21-03, 14:57
sdpeixoto sdpeixoto is offline
Registered User
 
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.
Reply With Quote
  #10 (permalink)  
Old 08-21-03, 15:47
Seppuku Seppuku is offline
Useless...
 
Join Date: Jul 2003
Location: SoCal
Posts: 721
Re: Close Window

Quote:
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.
Reply With Quote
  #11 (permalink)  
Old 08-21-03, 20:54
unatratnag unatratnag is offline
Registered User
 
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.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On