0

Hi,

I need an answer to a problem with iframe below.
I have an iframe jsp page which is a popup window from an other jsp page.
The iframe jsp popup window has few buttons.
I need the return reponse of button clicked from iframe in parent window.
BTW the parent window is not an iframe.

Could you please get me a solution for this?

thanks.

Amar.

2
Contributors
1
Reply
4
Views
7 Years
Discussion Span
Last Post by gumape
0

Hi,

you can access the parent window with the opener or the parent property:
- if a document opens a page in a new browser window (for example, by an anchor element or the open method), then the opener property can be used in the child document to access the parent window object.
- if the current document is within a frame or iframe and you need the window that hosts the current window, use the parent property.

Example for frames:

in the parent window:

<script>
	function OnFrameButtonClick () {
		alert ("You clicked on a button in the frame");
	}
</script>

in the child frame window:

<head>
    <script>
        function OnButtonClick () {
				// check whether the parent window and the OnFrameButtonClick method exist
			if (window.parent && parent.OnFrameButtonClick) {
				parent.OnFrameButtonClick ();
			}
		}
	</script>
</head> 
<body>
	<button onclick="OnButtonClick ()">Test</button>
</body>

You can find further examples on the following sites:
opener property,
parent property.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.