Home > DeveloperSection > Forums > How to open popup window into screen center?
Ankit Singh

Total Post:341

Points:2389
Posted on    November-01-2012 2:50 AM

 JavaScript JavaScript 
Ratings:


 1 Reply(s)
 1749  View(s)
Rate this:
Hi,
I'm working on asp.net, and i try to open a popup windows into screen middle. what i do?


AVADHESH PATEL

Total Post:604

Points:4228
Posted on    November-01-2012 7:22 AM

use the JavaScript to open popup window in center.

function popup(pageURL, title, popupWidth, popupHeight)
    {
        var left = (screen.width / 2) - (popupWidth / 2);
        var top = (screen.height / 2) - (popupHeight / 2);
        var targetPop = window.open(pageURL, title, 'toolbar=no, location=no, directories=no,
status=no, menubar=no, scrollbars=YES, resizable=YES, copyhistory=no, width=' + popupWidth + ',
height=' + popupHeight + ', top=' + top + ', left=' + left);
    }


Don't want to miss updates? Please click the below button!

Follow MindStick