PDA

View Full Version : Link within popup


Jeepers34683
09-23-2002, 05:53 PM
I just know this is easy and I'm too dumb to figure it out!

I have a pop-up "help" window. I want to direct viewers to another page on my web site for add'l info. How do I make the link so that it:

(a) closes the popup window; and
(b) opens the new link in the parent window (instead of opening a whole new window)?

Thanks for your help! :)

adios
09-23-2002, 06:04 PM
You can always reference the 'parent' window (parent is really for frames) as opener from the pop-up.

<script type="text/javascript" language="javascript">

function exit(url) {
if (opener && !opener.closed) opener.location = url;
self.close();
}

</script>

<a href="javascript:void exit('newpage1.htm')">jeepers 1</a>
<a href="javascript:void exit('newpage2.htm')">jeepers 2</a>

Jeepers34683
09-23-2002, 06:15 PM
Thank you so much, adios! It works great. Now one more question:

What if I have more than one link?

;)

adios
09-23-2002, 06:25 PM
Just pass the new url as an argument (parameter) to the function.

Edited the above.

You're welcome...

http://www.dwfaq.com/Tutorials/JavaScript/thefunction.asp

Jeepers34683
09-23-2002, 06:33 PM
adios, you are my new friend. Thanks for not only showing me WHAT to do, but taking me to a tutorial on HOW. I learned something very valuable today!

Jeepers :D