background
|
|
Hosting
My-Hosts.com
Cheap Hosting, domain registration and design. Check this out for more details.
More icon

Games
Ruffnecks Gaming Gaming for everyone
More

Tombstone
Tombstone Tuning Home of tuning, projects and fast cars and boats.
More
|
|
Up Image
Navigation
Search this Site
Enter your search terms

Site Breadcrumb - You are here
|
Thau's JavaScript Tutorial
Lesson 3

by Thau!

Page 5 — Windows Features

The third parameter of the window.open() method is a list of features that you'd like your window to have. As you've seen, if you don't include this parameter at all, the window will contain all the features of a default browser window.

However, if you specify any features in the third parameter, just those features will appear. The way to specify that you'd like your window to have certain features is to list them as a comma-separated list.

For example, if you write ...

window.open
("some_url","window_name","location,menubar");

... you'll get a window with just the location box (the place in your browser where you type in a URL) and a menu bar (File, Edit, etc.). Note: that these code samples may wrap to fit here in your browser, but they should be all on one line, no spaces, when you actually use them.

Here's another example:

window.open("some_url","window_name",
"location,height=100,width=100");

This will open a window that is 100 pixels high and 100 pixels wide and has no features other than a location field. Notice again that there are no spaces in the string.

If you'd like to open a window that has almost all the features, you can specify which features you don't want by setting those features equal to no. For example:

window.open("some_url","window_name",
"location=no,status=no");

This will open a window that has all the features except the location field and the status bar. Here's a list of the features that you can include in the feature string:

menubar
This is the row of functions that appears on most software applications. Normally it includes File, Edit, and a few other items.

status
This is the message bar at the bottom of your window. When you move your mouse over an HTML link, the URL appears in the status bar. You may have seen pages that use JavaScript to turn this status bar into a scrolling marquee. I'm not going to show you how to do this. If you want to know, you have to figure it out yourself. "Down with marquees," the monkey cried!

scrollbars
This allows scrollbars to appear when necessary.

resizable
If resizable is listed, the window can be resized. Be careful of the spelling. I always get it wrong.

width
The width of the window in pixels.

height
The height of the window in pixels.

toolbar
The browser toolbar, which contains the Back and Forward buttons, the Stop button, and the Home button, among others.

location
The text area of a browser into which you can type URLs.

directories
The directories that Netscape browsers have called "What's new," "What's cool," and so on.

Here are some examples of different types of windows.

Once you've checked out the examples, and maybe tried bringing up some windows of your own, it's time to learn how to mess with the contents of the windows.

next page»