Focus on new browser window

G

Guest

Hi

I am having a problem with opening a new browser window through a
client-side javascript (window.open/_blank) function. The window do "pop up"
but behind the window where I pushed the "pop up" button. It works ofcause
with the window.showModalDialog method but then postback causes another
window to pop up, so I'm back to the window.open method.

How can I set foucs on the new pop-up window from the parent browser window?

Thanks
Peter
 
S

Siva M

Hello,

Use the focus() method on the opened window reference as in:

<script>
function popupWindow()
{
var popWin = window.open ("http://www.google.com", "newWin");
popWin.focus();
}
</script>

Hi

I am having a problem with opening a new browser window through a
client-side javascript (window.open/_blank) function. The window do "pop up"
but behind the window where I pushed the "pop up" button. It works ofcause
with the window.showModalDialog method but then postback causes another
window to pop up, so I'm back to the window.open method.

How can I set foucs on the new pop-up window from the parent browser window?

Thanks
Peter
 
E

Eliyahu Goldin

Peter,

Use window.showModalDialog and put a line

<base target=_self>

in the <head> section of the dialog to solve the "another window on
postback" problem.

Eliyahu
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,773
Messages
2,569,594
Members
45,114
Latest member
GlucoPremiumReview
Top