Thursday, August 6, 2009

Focus Popup Window

When you click on a field that opens a popup window. Now if you this window is still opened but not focused and you click on the field again, a new window opens. This might be a requirement for some but mostly we want to get the focus back on the already opened window. This is a simple task here is the solution.

window.open('something.aspx', 'OpenWindow', 'toolbar=no,width=750px,height=500px,top=100px,left=130px,scrollbars=yes,resizable=1,menubar=no');
var txt = 'something.aspx';
OpenWindow=
window.open(txt, 'OpenWindow', 'toolbar=no,width=750px,height=500px,top=100px,left=130px,scrollbars=yes,resizable=1,menubar=no');
if (window.focus) {
OpenWindow.focus();
return false;
}

No comments:

Post a Comment