Click to See Complete Forum and Search --> : How to make popup windows focus


pug
12-19-2002, 08:18 PM
Hi,

I'm having trouble making a pop up window the focus once it has been created. The code to create the window is as follows

internal=window.open("../internal/template.html","internalWin","");
internal.focus();

The window creates fine but then it moves to the back and the parent remains the focus. I tried using internal.window.focus() with no luck either

thanks in advance
pug

swon
12-19-2002, 08:25 PM
Write in the internal/template.html on the bottom of the page:

</body>
<script language=javascript>
window.focus();
</script>

that will bring you the focus to this window.

pyro
12-19-2002, 08:26 PM
Try this code. The default should be for this to be focused.

var page = "../internal/template.html";
var windowproperties = "width=550,height=300,location=yes,toolbar=yes,menubar=yes,scrollbars=yes,resizable=yes";
var name = "internalWin";

window.open(page, name, windowproperties);

pug
12-19-2002, 08:44 PM
thanks,

that worked a treat, didn't think of trying that

cheers
pug