JavaScript Program to Position Newly Created Window Using JavaScript

Write a JavaScript program to position newly created window using JavaScript.



Source Code
<html>
<head>
    <title>Position window using JavaScript</title>
    <script>
        function createNewWindow() 
        {
            var x = screen.width / 2 - 150
            var y = screen.height / 2 - 100
            var style="status=1, toolbar=1, location=1, width=300, height=200, scrollbars=1, resizable=0, directories=1, menubar=0,left=" +x+",top="+y
            myWindow = window.open("radio.html", "myWindow", style)
        }
    </script>
</head>

<body>
<input type="button" value="Create New Window" onclick="createNewWindow()"/>
</body>

</html>
Output