Solved

Reference other window (not child)

Posted on 2011-09-07
10
179 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
  • 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
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 

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

ScreenConnect 6.0 Free Trial

At ScreenConnect, partner feedback doesn't fall on deaf ears. We collected partner suggestions off of their virtual wish list and transformed them into one game-changing release: ScreenConnect 6.0. Explore all of the extras and enhancements for yourself!

Question has a verified solution.

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

jQuery is a JavaScript library that greatly simplifies JavaScript programming. AJAX is an acronym formed from "Asynchronous JavaScript and XML."  AJAX refers to any communication between client and server, when the human client does not observe a…
This article discusses how to create an extensible mechanism for linked drop downs.
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…

772 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