This week's book giveaway is in the OCPJP forum.
We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line!
See this thread for details.
The moose likes HTML, CSS and JavaScript and the fly likes How to open a separate new window Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "How to open a separate new window" Watch "How to open a separate new window" New topic
Author

How to open a separate new window

Saurabh Saha
Ranch Hand

Joined: Dec 08, 2004
Posts: 52
Hi,
I want to open a new popup window that not depend on it's parent window. I'm using window.open inside javascript that display some message. when user click on the ok button of this window only then remaining code of my parent window are executing. I want to open a separate window to dispay a message so that if user not click on the ok button my code on the parent window still execute.
please help me!

Thanks,
Saurabh
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61447
    
  67

Moved to HTML/Javascript.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Niki Nono
Ranch Hand

Joined: Mar 20, 2005
Posts: 256
what you need is a modal dialog box.

try
window.showModalDialog(url,....


Life called,so here I am.<br />Cheers<br />Niki.:-)
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61447
    
  67

Be aware that modal boxes are IE-specific.
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
Originally posted by Bear Bibeault:
Be aware that modal boxes are IE-specific.


Bear, I think you need to re-look at Mozilla. They have implemented it!

Eric
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61447
    
  67

OK, let me re-phrase: be aware that modal dialogs are non-standard and some browsers support different prorietary means to implement them. showModalDialog, for example, is IE-specific.
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
lol....
Saurabh Saha
Ranch Hand

Joined: Dec 08, 2004
Posts: 52
Hi,
Thanks for replies.
I want to open a popup window in which I show some message and there would be a close button to close this window, if user does not close this window I want to close this window after 10 seconds.I had tried an example code with window.open as show below:

windowHandle = window.open('childPage.jsp','mywindow','width=400,height=200');
setTimeout('windowHandle.close()',10000);

It is working fine it open a new window and close this window after 10 seconds, but I can not send any argument by using window.open so I tried showModalDialog() to open a new window, I'm specific for IE so showModalDialog() is working fine in this browser. In my new code I'm using:
showModalDialog('childPage.jsp',ArgumentPassed,'dialogHeight:9;dialogWidth:27;help ff;status:no;fullscreen=no;unadorned=yes');
I want to close this window after 10 seconds.

Thanks,
Saurabh Saha
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
put the window.close() into the modal window code instead of the parent.

Eric
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to open a separate new window