Javascript Lesson 12


A very useful, and possibly the most abused feature of JavaScript is its ability to manipulate browser windows. As long as you open only one new window at a time, there is no problem. But creating several Pop-up Windows at once can be a real pain.

12.1 The Pop-up Window Properties

Below is a list of Properties from the Pop-up Window

  • location: The box allowing the user to type a URL.
  • menubar: The menu bar (File, Edit, View, etc.)
  • resizable: The user can resize the new window by dragging.
  • scrollbars: The new window has scrollbars.
  • toolbar: The toolbar (Back, Forward, Reload, etc.)

12.2 Creating a Pop-up Window

Click the link below to see an example of a Pop-up Window:

Pop-up Window

This can be done by writing a simple JavaScript function and then calling it from a link in the document. Here is the JavaScript code for the function:

<script language="JavaScript">
function popupWindow(URL){
	NewWindow =, name, 'width=311,height=330,location=no,menubar=no,resizable=no,scrollbars=no,toolbar=no')

Now you'll only have to put a link in your document like this:

<a href="javascript:popupWindow('/learn/javascript/BSD.jpg')">Pop-up Window</a>

12.3 Exercices

  • Make a Pop-up Window that is resizable and has a menubar.
  • Try using all of the Pop-up Window's properties.
Home | Code | Learn
© 2007-2008 ProgLogic, all rights reserved. | is created by Stijn Strickx. | e-mail