This week's book giveaway is in the Spring forum.
We're giving away four copies of Modern frontends with htmx and have Wim Deblauwe on-line!
See this thread for details.
Win a copy of Modern frontends with htmx this week in the Spring forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Closing Child Window from frameset

 
Ranch Hand
Posts: 68
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 68
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Are you referencing the frame that holds them?

frameName.popUpName.close();

Eric
 
Deepa More
Ranch Hand
Posts: 68
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
reply
    Bookmark Topic Watch Topic
  • New Topic