1. Basic Popup Windows
Join the Discussion
With HTML you can open a page in a new window by using target="_blank". The problem with this is that you have no control over the size of the new window that is opened, where it is positioned on the screen, or what browser control bars display on that window.
Here's an example of the code to use to create our simple popup window:
So how do we actually execute this code? Well that depends on exactly when we want the popup window to appear. Let's say that we want the window to appear as a result of clicking on a link. In this instance the code that we use might look something like this:
menubar=no,scrollbars=no,resizable=no'); return false;"
For an example of how this script works click here.
You will notice that I have placed a link at the bottom of the page in the popup window that can be selected to close the window. The code that needs to be included to do that is as follows:
<a href="#" onclick="self.close();return false;">Close Window</a>
Another way that you can use popup windows is to display then either when your visitor first enters the page or when they exit from the page. You do this by executing the window.open command in either the onload or onunload parameter of the body tag.
Introduction | Simple Popup