By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
431,780 Members | 1,549 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 431,780 IT Pros & Developers. It's quick & easy.

How to prevent closing a child window wthout closing Parent window

P: 1
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
Share this Question
Share on Google+
2 Replies


dorinbogdan
Expert 100+
P: 839
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

P: 15
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.