How to create JavaScript Popup Window (open new window javascript)

Creating popup using JavaScript is not so tough, Here is the code that will do the magic. Just copy and paste and start using it!

There are number of ways to create Javascript Popup

Method 1:


<script language="javascript" type="text/javascript">

function popup() {'','name','height=500,width=600');

<a href="#" onclick="popup()">Open Popup</a>

See the ouput for the above code here:

Open Popup

When you click the above link my site will open in a new window!.

See the line no. 7 : Here i have given my site name instead you can give any page ‘popup.html’  or ‘subfolder/test.html’'','name','height=500,width=600');


Method 2:

In the previous method we call a function outside of the ‘<body>’ Tag. Instead you can call in the ‘<a>’ tag itself, so no need to write the JavaScript Function inside the  ‘<script>’ Tag!


See the Code Below:

<a onclick="'','PingStatistics','status=0,toolbar=0,menubar=0,scrollbars=1,location=0,resizable=0,width=500,height=800');" href="javascript:void(0);">
Click to Open Popup

Click to Open Popup

Test the Above link by Clicking it!.

About the Author


Software Engineer, Blogger etc., Visit my Youtube channel - <a href="">Click Here</a>

Leave a Reply

Your email address will not be published. Required fields are marked *