Multiple pop-up windows can be a real pain, especially now that certain free web space companies are getting in on the act as a method of advertising, so go easy on them. A good rule of thumb is: if you’re opening two new windows, you’re opening one too many!
What does a pop-up window look like?
Splendid! How do I do one?
It’s really simple. Here’s the function that made that window appear:
This creates a new window called
"boo", which displays the HTML page
boo.html, and is 180 pixels wide and 50 pixels high.
openWinBoo() is called when you click on the link above. The code for the link looks like this:
Let’s take a closer look at our function. The last argument between the parentheses specifies how our new window will look. In our example, we’ve just specified the width and height with
'width=180,height=50'. However, there are many properties of the window that are under our control:
- The “what’s new/what’s cool” bar (Netscape only!)
- The box allowing the user to type a URL
- The menu bar (File, Edit, etc.)
- The user can resize the new window by dragging
- The new window has scrollbars
- The toolbar (Back, Forward, etc.)
Each of these properties can have the value of
"yes" (the feature will appear in the new window) or
"no" (the new window will have that feature disabled).
An important point to note about these properties is that they mustn’t have spaces between them. For example,
'width=180,height=50' will work, but
'width=180, height=50' won’t.
For example, this function creates a new window with just the menu and the URL entry box:
Click here to see it in action.
Now you know how to make a new window appear, and how to make that window look the way you want it. Try playing with different properties in the