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 a 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 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

That’s it

Leave a Reply

Theme: Overlay by Kaira