Javascript: Popup Windows

This post shows you how to create a basic popup window using Java Script as well as a reference list of options for popups.

JavaScript allows you to open new windows from within your HTML code. You can even have actions in one window effect another window.

Create a Basic Popup Window

The code to open a new window is straightforward. It gets more complicated when you add different options, and when you navigate around multiple windows.

Syntax: window.open([url],[title],[options]);
View More

window.open("win1.html","Window1","menubar=no,width=430,height=360,toolbar=no");

In the above example, the syntax is to first specify the web page to load into the window. Next, set the title of the window. Last, specify the options for the window. Note: the options are all in a single set of quotes.

Option Values Description Version
location yes|no Does the location bar show? ver 1.0
menubar yes|no Does the menubar show? ver 1.0
scrollbars yes|no Do scrollbars show? ver 1.0
status yes|no Does the status bar show| ver 1.0
titlebar yes|no Does the titlebar show? ver 1.0
toolbar yes|no Does the toolbar show? ver 1.0
resizable yes|no Can you resize the window? ver 1.0
height pixels height of window ver 1.0
width pixels width of window ver 1.0
directories yes|no Does the personal toolbar show? ver 1.2
innerHeight pixels specifies the inner height of window ver 1.2
innerWidth pixels specifies the inner width of window ver 1.2
screenX pixels specifies distance from left edge of screen ver 1.2
screenY pixels specifies distance from top edge of screen ver 1.2