469,645 Members | 1,752 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,645 developers. It's quick & easy.

How to prevent closing a child window wthout closing Parent window

Hi all,

1) i opened a parent window.
2) then i opend a child window thruogh this parent window.

Now i want to close child window before closing the parend window
means my clients can not be close the parent window without closing the child window.

please reply me.
if there is any solution for this....

thanks

Arvind Kumar
Feb 26 '07 #1
2 1939
dorinbogdan
839 Expert 512MB
use an array of references to the child windows, like:

Expand|Select|Wrap|Line Numbers
  1. var childs = [];
  2. ...
  3. var childs[childs.length] = window.open("child1.htm")
  4. ...
  5. var childs[childs.length] = window.open("child2.htm")
  6. ...
  7. var childs[childs.length] = window.open("child3.htm")
  8.  
then set a function to the "onunload" event of the parent window, like:
Expand|Select|Wrap|Line Numbers
  1. function unloadChilds(){
  2. for (var i=0; i<childs.length;i++){
  3.  childs[i].close();
  4. }
  5. }
Feb 26 '07 #2
Hi,

If u r working on windows application,U should try Form2Obj.ShowDialog()







use an array of references to the child windows, like:

Expand|Select|Wrap|Line Numbers
  1. var childs = [];
  2. ...
  3. var childs[childs.length] = window.open("child1.htm")
  4. ...
  5. var childs[childs.length] = window.open("child2.htm")
  6. ...
  7. var childs[childs.length] = window.open("child3.htm")
  8.  
then set a function to the "onunload" event of the parent window, like:
Expand|Select|Wrap|Line Numbers
  1. function unloadChilds(){
  2. for (var i=0; i<childs.length;i++){
  3.  childs[i].close();
  4. }
  5. }
Mar 5 '07 #3

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

5 posts views Thread by Ron L | last post: by
1 post views Thread by Chris Bruce | last post: by
1 post views Thread by jd | last post: by
reply views Thread by gheharukoh7 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.