Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Multiple popups focus issue

Status
Not open for further replies.

RexJacobus

Programmer
Dec 10, 2001
47
NZ
Hello,

I have a page with several puzzles. I want the user to be able to click on a puzzle and the solution will come up in a popup. That part works fine. My problem is that if the user clicks on a second solution the first popup goes behind the main screen. I want the popups to remain on top of the main screen until they are closed or minimized by the user.

Here is the code I'm using:

<a href="ViperGrey.html" onclick="window.open('ViperGrey.html','popViper','left=650,top=200,width=580,height=400,scrollbars=no,resizable=no,toolbar=no,directories=no,location=no,menubar=no,status=no'); return false">

I am not using a function because each screen has different dimensions.

RexJ
 
By saying 'popups' (plural) instead of 'popup' (singular), you imply that you want multiple popups. This will not happen if they all have the same name (the second parameter in the window.open call)... so the first thing you should do is ensure that the window name is different per game, or blank (which will always open a new window).

Once the window is open, you could try and give it focus, something like:

Code:
onclick="winHandle = window.open(...); winHandle.focus();"

If that fails, you could try and blur the main window, something like:

Code:
onclick="winHandle = window.open(...); winHandle.focus(); window.blur();"

Failing that, I think you're out of luck. Note: some browsers allow users to disable this functionality, and some may not provide it at all... so you might be out of luck, really.

Dan



Coedit Limited - Delivering standards compliant, accessible web solutions

Dan's Page [blue]@[/blue] Code Couch:
Code Couch Tech Snippets & Info:
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top