aspose file tools*
The moose likes HTML, CSS and JavaScript and the fly likes Closing Child Window from frameset Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of JavaScript Promises Essentials this week in the JavaScript forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Closing Child Window from frameset" Watch "Closing Child Window from frameset" New topic
Author

Closing Child Window from frameset

Deepa More
Ranch Hand

Joined: May 22, 2006
Posts: 68
Hi,
The problem I am facing is as follows:
1. I have framset which consists of 3 frames, say top(header), main, & bottom(footer).
2. I open child windows from the links given in main frame. Function to open window is written in js.
3. I want to close frameset window if all child windows are closed, else frameset sholud not be closed.
4. I have added function to close child windows in frameset(which internally calls fuction in js), but if I store that array variable containing child windows in js, then while closing frameset variable value is lost. And if I store it in frameset, then how do I acces it from js.

I have gone through the posts similar to this, but didn't find solution for me.

Thanks,
Deepa
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
The only way you can close a window with window.close() is if it was created with JavaScript with window.open().

Eric
Deepa More
Ranch Hand

Joined: May 22, 2006
Posts: 68
I am using window.open() method only, to open child windows.
But the problem is where do I store that variable which contains list of all child windows. Actually that js file is included almost many of the jsps which has function to open child windows. And when I call close function to close child ones from frameset(parent), that variable doesn't have value assigned.

Thanks for the reply.
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
Are you referencing the frame that holds them?

frameName.popUpName.close();

Eric
Deepa More
Ranch Hand

Joined: May 22, 2006
Posts: 68
Hi Eric thanks again for reply, But Why framename is required, if am storing all opened windows in array?
I am posting here situation, which is exactly similar to mine.

File1: frameset.html


File2: testlink.html

(note: used onklick as post was not saving corect one)

File3: default.js


When I run frameset.html, and opens up window,then close frameset.html, gives message 'All Child Windows are clsoed.'
What's wrong with this?
[ February 26, 2007: Message edited by: Deepa More ]
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
Each frame is like its own window. They share nothing in common other than a reference. If you want to keep a reference you can do something in the parent like this.



than in your frames you can do something like this to open a window:


if you need to reference it, it would be


And look at this on closing:
http://radio.javaranch.com/pascarello/2005/01/19/1106152877000.html

Eric
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Closing Child Window from frameset