PopupWindows.

 

Ignore the ..in each tag.

<...SCRIPT LANGUAGE="JavaScript">

<..!-- var urlWindow = null;

function openWindow (url)

{

var option = "toolbar=1,location=0, directories=0,status=0,menubar=0,scrollbars=1, resizable=1,width=620,height=460";

var urlWindow =

window.open( url, "NewWindow", option );

}

// -->

<.../SCRIPT>

 

A JavaScript popup window is a floating browser, only it is usually smaller than the parent window . A function statement is used to define whatever properties you want it to have, and a method, perhaps a simple text link, or a form button, is used to launch it. Netscape and Microsoft both have their own 'features' that make popup windows act a bit differently, and later versions of both have additional little 'extras' which can be controlled.

What you see there is a set of instructions for an open.window object. You have the URL of the page to load in the new browser, a NAME for that window, and the instructions for what to include and what not to when opening the new browser session. Again, contrary to the above example, make sure the instructions are all on the same line with no breaks or you'll get an error when you try to launch the window.

There are lots of options for how the window will appear. This is what they all mean (note the letter case, uppercase vs. lowercase. Also, yes=1 and no=0):

Window Appearance
Specific Code Visible Result
directories=yes,no/1,0 Do you want the standard browser directory buttons to appear?
height=number How many pixels high should the window be? Minimum is 100. This measures the content viewing area, not the entire browser window (frame, buttons, status line, etc.)
location=yes,no/1,0 Do you want the location field (where you enter new URLs to jump to) to appear?
menubar=yes,no/1,0 Do you want a menu at the top of the field? (Internet Explorer defaults to "yes".)
resizable=yes,no/1,0 Do you want the viewer to be able to resize the launched window?
scrollbars=yes,no/1,0 Do you want scrollbars to appear if necessary? The default is "yes".
status=yes,no/1,0 Do you want the status bar at the bottom of the pop-up? (Internet Explorer defaults to "yes".)
toolbar=yes,no/1,0 Do you want the toolbar (where the backwards and forwards buttons are) to appear?
width=number How wide, in pixels, should the pop-up window be? (minimum is, again, 100)

 

In addition, there's a special, all-encompassing tag: type=fullWindow This instructs the browser to open the new window to occupy the entire desktop and eliminate all browser features except the title bar. It is also known as "Netscape Canvas Mode" or "Kiosk Mode."

Netscape-Specific Window Tags

Window Appearance
Netscape Navigator 4+ only
Specific Code Visible Result
hotkeys=yes,no/1,0 If you want no menu bar, do you still want hot keys?
innerHeight=number The height, in pixels, of the window content area. This replaces "height=" but you can still use that.
innerWidth=number Same as above, only twisted. 100-pixel minimum holds true for both.
dependent=yes,no/1,0 Do you want the pop-up dependent (linked) with the current (opening) window? "yes" means when you close one, you close them both. (In Windows95, a dependent window does not show on the task bar.)
outerHeight=number This is the measurement, in pixels, of the entire window rather than just the content window. Watch that 100-pixel minimum!
outerWidth=number Same as above, only sideways

Microsoft-Specific Window Tags

Window Appearance
Internet Explorer 4.0+
Specific Code Visible Result
fullscreen=yes,no/1,0 Do you want the window to open in "full-screen mode" (occupying the entire desktop, absolutely without any browser controls at all) or normal mode? (Use Alt+F4 to close the window.)
channelmode=yes,no/1,0 Do you want to open the window in Microsoft's "theater mode" with the channel band?

 

Dueling (Separate But Equal) Window Tags

Window Appearance
Specific Code Visible Result
screenX=number
(Nav4)

left=number
(MSIE4)
Specifies the number of pixels the pop-up will appear from the left side of the screen. Why? Hell if I know. You cannot set a negative number here.
screenY=number
(Nav4)

top=number
(MSIE4)
Same as above, distance from top of screen.

 

Launching Windows
Now that you've designed your window, you may be wondering how to launch into space. It's actually quite a simple matter. You can use either a text or graphic link:

<A HREF="JavaScript:openWindow('anyurl.htm');">
PUT TEXT HERE</A>
or
<A HREF="JavaScript:openWindow('anyurl.htm');">
<img src="graphic.gif" height=20 width=20></A>
Closing Windows
Users can close the window themselves, or you can put some special code in the window on which they can click to close the window. For example:
<A HREF="JavaScript: self.close();">Close Window</A>