472,782 Members | 1,280 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,782 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 1272
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...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 2 August 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
linyimin
by: linyimin | last post by:
Spring Startup Analyzer generates an interactive Spring application startup report that lets you understand what contributes to the application startup time and helps to optimize it. Support for...
0
by: Taofi | last post by:
I try to insert a new record but the error message says the number of query names and destination fields are not the same This are my field names ID, Budgeted, Actual, Status and Differences ...
14
DJRhino1175
by: DJRhino1175 | last post by:
When I run this code I get an error, its Run-time error# 424 Object required...This is my first attempt at doing something like this. I test the entire code and it worked until I added this - If...
0
by: Rina0 | last post by:
I am looking for a Python code to find the longest common subsequence of two strings. I found this blog post that describes the length of longest common subsequence problem and provides a solution in...
5
by: DJRhino | last post by:
Private Sub CboDrawingID_BeforeUpdate(Cancel As Integer) If = 310029923 Or 310030138 Or 310030152 Or 310030346 Or 310030348 Or _ 310030356 Or 310030359 Or 310030362 Or...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
0
by: lllomh | last post by:
How does React native implement an English player?
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...

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.