473,388 Members | 1,207 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,388 software developers and data experts.

parent.opener in several levels.

I have a site that make use of popup windows (on demand, i.e. when one clicks
on a link) to open up comments to texts in and such. It works great, but I have
a problem.

I have a small javascript that I use when I want to open a link in the "main"
window which looks like this:

function quicklink(what){
parent.opener.location=what;
}

This one works great, but sometimes, my popup window opens a popup window (may
sound weird to do, but there are occasions where it's quite logical) and using
quicklink() in this third window will open the link the the second, popup
window when I really would want to open it in the first, main window.

Is there are way to handle this, regardless of number of levels of opened
windows?

--
Sandman[.net]
Jul 23 '05 #1
2 1287
Ivo
"Sandman"wrote
I have a site that make use of popup windows (on demand, i.e. when one clicks on a link) to open up comments to texts in and such. It works great, but I have a problem.

I have a small javascript that I use when I want to open a link in the "main" window which looks like this:

function quicklink(what){
parent.opener.location=what;
}

This one works great, but sometimes, my popup window opens a popup window (may sound weird to do, but there are occasions where it's quite logical) and using quicklink() in this third window will open the link the the second, popup
window when I really would want to open it in the first, main window.

Is there are way to handle this, regardless of number of levels of opened
windows?

You 're npot making it very easy on yourself or your users, I guess you
realize that already. What you can do is name the original window, like so:

window.name='mainwindow';

then have the function check the chain of openers for that name, like so:

var el=parent.opener;
while( el.opener && el.name !== 'mainwindow'' ) el=el.opener;
el.location=what;

HTH
Ivo
Jul 23 '05 #2
Sandman wrote:
I have a site that make use of popup windows (on demand, i.e. when one clicks
on a link) to open up comments to texts in and such. It works great, but I have
a problem.

I have a small javascript that I use when I want to open a link in the "main"
window which looks like this:

function quicklink(what){
parent.opener.location=what;
}
Why "parent" ?
Mick
This one works great, but sometimes, my popup window opens a popup window (may
sound weird to do, but there are occasions where it's quite logical) and using
quicklink() in this third window will open the link the the second, popup
window when I really would want to open it in the first, main window.

Is there are way to handle this, regardless of number of levels of opened
windows?

Jul 23 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: mannerfanner | last post by:
In order to reload the opener window from a child window I want to check the parent windows state. The following code works fine in IE and Mozilla: if(top.opener && !top.opener.closed) {...
2
by: Randell D. | last post by:
Folks, I have got this working before, in part with some help from this ng but I never really understood how I got it working... and last time, I was using it via a popup window as opposed to an...
2
by: Raj | last post by:
Hi All, I have a problem with trying to refresh the parent window from child window in order to update data in the parent window. The sequence of events are 1) I click a button in the parent...
4
by: Phil Powell | last post by:
I thought this would work but it seems to not work neither in Netscape nor in IE: <script type="text/javascript"> <!-- // OBTAINED FROM http://www.javascripter.net/faq/settinga.htm //...
7
by: Alan Little | last post by:
I have a popup which contains a frame set; one of the frames contains a form. When the form is submitted, I want it to go back to the opener of the popup. I have: document.forms.target =...
3
by: rick2910 | last post by:
Hello, I have a problem with a popup. In this popup (child) are several links. I want these links to open in A NEW parent window. Code: <a href="javascript:;"...
1
by: jerkyjerk | last post by:
Ei guys..newbie in programming..just want to ask how will I compare the contents of particular cell of the table(from parent window) to the contents of a cell of the table (child window)? how will I...
1
by: Bali | last post by:
Default.aspx is the starting page containing a control(ascx) which has asp:button control on it. On the button click event it has to open a new page as a modal control. Since refreshing a page in...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.