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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Window.Focus()

Status
Not open for further replies.

brixel

Technical User
Apr 1, 2005
1
US
Hey guys,

I'm not sure if this is doable. I pop a window, and I want that window to maintain focus until the user closes it. I can keep the window in focus, but the problem is that it contains a form, and if the user starts filling out the form the window thinks it has lost focus, and tries to refocus itself.

This is bad because my drop downs clear out while a user is making a selection.

I've search a great deal, but can not seem to find a way to detect the status of a window's focus. It would be great if I could say:

if (window.isNotFocused) {
window.focus();
}

But no such property exists. How, or is there a way to do what I'm trying to do? Thanks.
 

If this is for IE only, then you could use showModalDialog.

Reliably keeping a window on top isn't really practical with JavaScript, however.

Hope this helps,
Dan


[tt]D'ya think I got where I am today because I dress like Peter Pan here?[/tt]
[banghead]

 
This thread deals with closing a window when it loses focuse:

You could adapt the code for your use. Note the two different code paths -- one for IE, one for other browsers.

If, however, you need a more reliable solution, then you could try some non-standard, browser specific solutions -- in IE, the showModalDialog, in Firefox the special dialog property in window.open (
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top