0

Hi good day!
I just want to know on how to center a new page window when click.. I have this java script below but it appears on top left. I want it to appear center of the screen on even in different resolution!

<a href="javascript:void(window.open('http://localhost/nonescostmpc/accnt_login.php','','width=350,height=220,left=0,top=0,resizable=no,menubar=no,location=no,status=no,scrollbars=no'))">

thank you!

2
Contributors
2
Replies
3
Views
6 Years
Discussion Span
Last Post by blocker
0

Try this script..

<head>
<script>
function windowCenter(pageURL, title,w,h) {
var left = (screen.width/2)-(w/2);
var top = (screen.height/2)-(h/2);
var targetWin = window.open (pageURL, title, 'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, copyhistory=no, width='+w+', height='+h+', top='+top+', left='+left);
}
</script>
</head>
<body>
<a href="#" onclick="windowCenter('pop_up_window_center.html', 'POPUP',400,400);">OPEN POPUP</a>
</body>
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.