new at js - question about window objects

R

rusty

I run a website with most pages built on a template with nav bar etc.

On one of my template pages (call it "A"), I have links to diagrams that
open in js-defined "popup" type windows (call it "B"). At the bottom of the
diagram is an option to click on a link for a 'text version' of the diagram.
I did manage to get the popup to close by embedding [
onclick="self.close()" ] in the anchor tag.

However the text version opens a new window in the template series (call it
"C"), so both "A" and "C" are now open.

Is there any JS code I can implement to force the text-version to open in
the template window ("A") that is already open (ie, the parent of the popup
window) ...?

thanks for any pointers ...

rusty
 
L

Laurent Bugnion, GalaSoft

Hi,
I run a website with most pages built on a template with nav bar etc.

On one of my template pages (call it "A"), I have links to diagrams that
open in js-defined "popup" type windows (call it "B"). At the bottom of the
diagram is an option to click on a link for a 'text version' of the diagram.
I did manage to get the popup to close by embedding [
onclick="self.close()" ] in the anchor tag.

However the text version opens a new window in the template series (call it
"C"), so both "A" and "C" are now open.

Is there any JS code I can implement to force the text-version to open in
the template window ("A") that is already open (ie, the parent of the popup
window) ...?

thanks for any pointers ...

rusty

A pop-up always knows her opener. The "opener" property is a reference
to the Window object which represents the pop-up's opener.

In other words, instead of closing B and opening C, you can close B and
modify the location of A.

The code would be something like:

<A HREF="#"
ONCLICK="loadTextVersion();">Link text</A>

with:

function loadTextVersion()
{
opener.location = "textVersion.txt";
self.close();
}

HTH,

Laurent
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,082
Messages
2,570,587
Members
47,209
Latest member
Ingeborg61

Latest Threads

Top