Javascript: Open new popup window at the center of the screen

 In this article,I will explain how to open new popup window center on screen using Javascript.
 I have written java script function that opens a new popup window at the center of the screen.We are using window.open method of javascript

Syntax
 window.open([URL], [Window Name],..... );

Example: Center popup Window

<html>
<head>
<script >
function PopupWindowCenter(URL, title,w,h)
{var left = (screen.width/2)-(w/2);
var top = (screen.height/2)-(h/2);
var newWin = window.open (URL, 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="javascript:void(0);" onClick ="PopupWindowCenter('http://www.example.com', 'PopupWindowCenter',600,700)">Open Center popup Window</a>
</body>
</html>

Now you can open a simple popup window at the center of the screen.