Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

keeping pop up window active until clicked

 
jay donald
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 64971
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
jay donald
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 64971
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 64971
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
To see one of my implementations of this in action, visit http://www.bibeault.org/blackbox/
 
Manesh Kumar
Ranch Hand
Posts: 94
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic