Solved

Reference other window (not child)

Posted on 2011-09-07
10
186 Views
Last Modified: 2012-05-12
I have a window which is opened via window.open method from an iframe.

I need to be able to access the popup window from a document in a different iframe.

I have given the popup window the name HRA and tried to call hra.close from the other iframe but it is not working. How do I get a reference to the popup window from the iframe that did not spawn it?
0
Comment
Question by:sailing_12
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 4
10 Comments
 
LVL 82

Expert Comment

by:leakim971
ID: 36497198
save the reference on the parent window.
ask the parent window to do the job (close window)
0
 

Author Comment

by:sailing_12
ID: 36497337
I don't actually want to close it, that is just a test to see if I'm referencing it successfully.

I actually want to call a function on the page.
0
 
LVL 82

Expert Comment

by:leakim971
ID: 36497410
save the reference on the parent window.
ask the parent window to do the job :)
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:sailing_12
ID: 36497564

Is this right?

<a id="aHRABalance" runat="server" onclick="var w = window.open(this.href, 'HRApopupwindow', 'width=1080,height=500,scrollbars,resizable'); return false;"></a>
0
 
LVL 82

Expert Comment

by:leakim971
ID: 36497616
remove "var "
I suppose there's a href at the end.
0
 

Author Comment

by:sailing_12
ID: 36497730
the href is being written programattically from .vb codde-behind (this is .net app).

This code successfully gets me the title of the page on which the function is written I want to fire. How do I call the function?
parent.frames['IFRAME_ResourceArea'].document.frames['ifrmBenefits'].document.title

Open in new window

0
 

Author Comment

by:sailing_12
ID: 36497822
Sorry, that last code succesfully gives me the title of the document which spawned the popup - the function I want to get at is in the head of the document loaded in the child popup.
0
 
LVL 82

Accepted Solution

by:
leakim971 earned 400 total points
ID: 36497911
try :
parent.frames['IFRAME_ResourceArea'].document.frames['ifrmBenefits'].the_function()


0
 

Author Comment

by:sailing_12
ID: 36498152
I got it. Included the reference to the child window (renamed hraPopupRef)
parent.frames['IFRAME_ResourceArea'].document.frames['ifrmBenefits'].hraPopupRef.UncheckHRAClaims()

Open in new window

0
 

Author Closing Comment

by:sailing_12
ID: 36498165
Thanks.
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In Part 1 (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/A_7849-Hex-Maze.html) we covered the hexagonal maze basics -- how the cells are represented in a JavaScript array and how the maze is displayed.  In this part, we'…
Introduction HyperText Transfer Protocol (http://www.ietf.org/rfc/rfc2616.txt) or "HTTP" is the underpinning of internet communication.  As a teacher of web development I have heard many questions, mostly from my younger students who have come to t…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question