...

View Full Version : Popup window link target original window?



Candrias77
09-26-2002, 01:14 PM
I have a little pop up window that displays the latest features of a website. I was wanting the normal <a href> links in this small popup window to target the original main page window.

The original window was never "created' so is not named, is it possible to name the window somehow and just target it with a simple <a target> or is there more to it?

I have seen this done with the log in window on www.domainz.net.nz but am not sure where to start.

Thanks.

Mr J
09-26-2002, 03:23 PM
Try the following


In the main page


<SCRIPT LANGUAGE="JavaScript">
<!--
function newWindow(file,window) {
msgWindow=open(file,window,'resizable=no,width=200,height=200');
if (msgWindow.opener == null) msgWindow.opener = self;
}
//-->
</SCRIPT>

<FORM>
<INPUT TYPE="button" VALUE="Open New Window" onClick="newWindow('a.html','window2')">
</FORM>



In the document loaded into the popup


<SCRIPT LANGUAGE="JavaScript">
<!--
function load(file,target) {
if (target != '')
target.window.location.href = file;
else
window.location.href = file;
}
//-->
</SCRIPT>

<A HREF="javascript:load('b.html',opener)">load document into opener</A>

adios
09-26-2002, 04:48 PM
No more to it. Name that window:

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

self.name = 'Candrias77';

</script>

Then:

<a href="...." target="Candrias77">

Candrias77
09-29-2002, 12:27 PM
yep, it was as simple as you said adios

thanks

johntod02
05-12-2009, 02:32 PM
suppose if we are hyperlinking a keyword, for example Search Engine Optimisation (http://www.alkemi.co.nz), to hyper link a keyword we use html. So is it also a type of coding.

johntod02
05-13-2009, 01:54 PM
good post

openminds
10-10-2014, 01:06 AM
No more to it. Name that window:

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

self.name = 'Candrias77';

</script>

Then:

<a href="http://codingforums.com/html-css/...." target="Candrias77">

I know this is an old post but this is the method I have used. But, my pop up window doesn't close. Any way to trigger that as well? Or am I going to have to head to the window.opener method?

Old Pedant
10-10-2014, 04:53 AM
Tacky coding, but it works:

<a href="http://codingforums.com/html-css/html-css/...." target="Candrias77" onclick="self.close();return true;">

But I really think that

<input type="button" value="whatever"
onclick="window.opener.location.href='whatever.html'; self.close();" />
is cleaner. You can easily style the button to make it look like a link if you prefer.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum