Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

"I have a... pop up, pop up, pop up...!"

Status
Not open for further replies.

Atchett

Programmer
Dec 7, 2000
35
0
0
Hi all,

I am have a rather irritating problem with a coulpe of pop up's and I am sure there must be a simple solution.
I have a pop up that allows users to register on the site and then another pop up which allows users to login to the site.
On the popup that allows users to register there is an option for users to login if they are already registered. This closes the registration pop up and opens the login pop up. When the user has logged in a new page appears allowing the user to close the window.
My problem is this (apart from having so many pop up's!!!) - When I close the popup I want the main page to be refreshed. This works fine if the user follows the registration process through or just the login process through using - window.opener.location.reload(); - but when I cross the two over i.e. close the registration pop up and open the login pop up from it, the window which opend the pop up has obviously closed and therefore cannot be reloaded. (I hope everyone is with me on this!)

Does anyone have any idea how I can reference the main browser window without using the window.opener method?

Many thanks,
 
Atchett,

name the first window, then reference it by name...

ad this to the first popup's code:
window.opener.name = "mainwindow";

then whatever window you are in when you want to close it:

mainwindow.reLoad();


you may also want to check for the "mainwindow"'s existence before reLoad, and place an onError just in case.. Hope it helps ;)

~ jsLove
 
Hi jsLove,

Thanks for the quick reply. I have tried the solution that you suggested. Unfortunatly it doesn't work. The problem seems to be that the window doesn't seem to get assinged the name. Also the user could open either (login or registration) window first. Is there a way that I can name the initial site window when it loads and then reference it - possibly in the <body> tag?

Many thanks,
 
Atchett,

place this in the head of the parent window:
window.name = &quot;myWin&quot;; Hope it helps ;)

~ jsLove
 
Hi jsLove,

Thanks again. How do I do that? Is it -
<head>window.name = &quot;myWin&quot;;</head> or
<head window.name = &quot;myWin&quot;;></head> or do I have to use some sort of <script> tags?

I've tried the first 2 but they don't work?

Sorry, am I being a bit dim? :)

Cheers,
 
Atchett,

sorry, here ya go:

<html>
<head>
<SCRIPT language=&quot;JavaScript&quot;>
<!--
window.name = &quot;myWin&quot;;
// -->
</SCRIPT>
</head>
<body>

</body>
</html> Hope it helps ;)

~ jsLove
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top