472,104 Members | 1,088 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,104 software developers and data experts.

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 2043
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 leo001 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.