[thelist] Quick JS question

Peter Hammar phammar at dplanet.ch
Mon Mar 19 15:47:06 CST 2001


Hi,

Here's a way to do this:

parent.htm:
<a href="#" onClick="window.open('child.htm', 'child');">child</a>

child.htm:
<a href="#" onClick="opener.location.href='http://www.foo.com';
self.close()">foo</a>

HTH,
Peter

> I have a link that I want to use to return to a site's home (ex. foo.com)
> because that's how they got to the page they are on (By clicking on a link
> on the site's home page, that opened the new window).
>
> But I want the site to load in the parent window (from whence they came).
If
> it has been closed I want it to open a new window and I also want the link
I
> click on to close the current window.
>
> I tried this:
>
> <a href="http://www.foo.com/" target="_parent"
> onClick="window.close()">foo</a>
>
> but it didn't work.  Hmm... maybe it's because I suck at JavaScript.
> Anyway, is there an easy way to do this?
>
> Thanks in advance,
>
> Dave






More information about the thelist mailing list