aspose file tools
The moose likes HTML, CSS and JavaScript and the fly likes keeping pop up window active until clicked Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Reply Bookmark "keeping pop up window active until clicked" Watch "keeping pop up window active until clicked" New topic
Author

keeping pop up window active until clicked

jay donald
Greenhorn

Joined: Feb 09, 2006
Posts: 20
Hi,

Can i keep the pop up window active until the user clicks on one of the buttons inside it. I don't want them to deactivate it by clicking on the parent window. Could some one please help me out by pointing me to the right direction. THanks.

Jay
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 56168
    
  13

I don't want them to deactivate it by clicking on the parent window.


What do you mean by "deactivate"? Clicking in the parent window will not cause anything to happen except for the parent window to gain focus.


[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
jay donald
Greenhorn

Joined: Feb 09, 2006
Posts: 20
Yes, that's exactly what i mean Bear. I don't want the parent window to be active till the user clicks on one of the buttons in the pop window. I don't know if it could be done or not.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 56168
    
  13

The way I handle this in a cross-browser manner is to not use window.open() (which is what I assume you mean by "pop up"), but to create a floating div that mimics a modal dialog.

When active, I reveal a full-window div that's semi-transparent that traps all events, as well as gives the window a "grayed-out" effect (which I call the "curtain"). A child of this div implements the "model dialog". The "curtain" remains in effect until the dialog is dismissed, making it "modal".

I'm sure that there are example implementations of such a scheme all over the web...
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 56168
    
  13

To see one of my implementations of this in action, visit http://www.bibeault.org/blackbox/
Manesh Kumar
Ranch Hand

Joined: Mar 21, 2006
Posts: 94

Can i keep the pop up window active until the user clicks on one of the buttons inside it. I don't want them to deactivate it by clicking on the parent window. Could some one please help me out by pointing me to the right direction. THanks.



You can try these.

On onblur handler of child window you can call window.focus(). This has to be written for window object of child window not on the body element.

but this might be annoying if the user is switching to some other application and the event will be triggered for setting focus.

So,

On onfocus event of parent window's window object, you can check if child window reference is not null, then call
child windowreference.focus().

Simplest method, if your application is tied with IE,

you can use showModalDialog() which is similar to open method.

Which will open the modal dialog, which will disallow user to access the parent window.


Manesh
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: keeping pop up window active until clicked
 
Similar Threads
How to disable popup menu in IE using javascript?
disabling windows close icon
window.open parent and Child
Need urgent Help - Browser is hanging
Pop-up window Issue