JavaScript > Methods

Opening popup window in JavaScript

How to open a popup window using JavaScrip?


In case we want to open a popup window from JavaScript, we can follow this approach.

    <script>
        function TestFunction() {
            window.open("http://www.dotnetfunda.com", "", "width=200,height=300");
        }
    </script>

    <input type="button" id="btnTest" onclick="TestFunction()" value="Click me" />

In the click of the above button, a new popup window opens with DotNetFunda.Com website.

  • The 1st parameter of Open method is url to open
  • The 2nd parameter is the name of the window that is being opened (can be used from javascript to identify this window)
  • The 3rd parameter is features that are to be used to open the window (eg. width, height, menubar, resizeable etc.)
OUTPUT
 Views: 4014 | Post Order: 53



Write for us






Hosting Recommendations