Copyright (c) (copr) 1997 all rights reserved by TJH Internet SP and Earth Operations Central.


Toolbars
Toolbars are a development of the Javascript window-control functions. They are an alternative to Frames. Many people do not care for frames, I myself find them to be a bother. They arbitrarily divide the available viewing space within your browser window. Toolbars, instead of dividing the available viewing area, create new windows which can be resized, or sent to the front of or behind other windows.

Please examine the code of this page. Some of the syntax and calls are specific to Netscape Javascript. That's the way I like it, since I run Linux and there's no greater fear for Microsoft or other for-fee operating systems that the threat of a completely free operating system. Netscape makes a very good browser for Linux, and I'm quite willing to pay for that - $20.00 or so dollars is not a huge expense for a standardized functionality atop an operating system which is otherwise cost-free. Microsoft, however, has a habit of taking platform-independent and OS-independent functionalities such as Java (tm, Sun Microsystems, Inc) or JavaScript (tm, Netscape) and "proprietizing" them - changing them so that they can only run well on Microsoft products. Therefor I choose to support Netscape and their JavaScript - they support multiple platforms and operating systems - as does the Internet.

When you open a toolbar with the toolbar script,


<center>
<font size=1>
<form name="opentoolbar">
  <script language="javascript">
   var toolbar = null;
   function openbarWindow() {
     toolbar = window.open(location.href ,'barWindow','toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,width=400,height=120');
     if (toolbar != null) {
       if (toolbar.opener == null) {
         toolbar.opener = self;
       }
     }
   }
   document.writeln('<input type="button" value="Open Toolbar" onClick="openbarWindow()">');
   // -->
   </script>
</form>
</font>
</center>

you cause the creation of a secondary window. This window can call assorted URL through standard syntax, and from those URL calls ("links") you can call secondary windows. To reduce screen clutter, I generally leave frills (such as the menubar, location, and status fields) to the main or primary window from which the toolbars or display windows are called.

One of the nicest features about toolbars and display windows is that they are exactly the size one specifies - if you've spent hours getting some visual format right, you want people to see what you designed - and toolbars allow that. You could spend hours on precise calls determining exact XY locations and sizes of your images, and you can drive yourself crazy with tables... but I'd rather just do it by guts, and call it art. Calling a secondary window is a great way to size a window perfectly and allow the browser to do the formatting work for you.

Here's a generic form to hack. This is now, as far as I am concerned, free to the public domain. It's slightly stolen and hacked-back from a javascript wizard's most-excellent Micro-application. This is noted and you must cite his copyright when you use this. Here it is:

## keywords to search-and-replace

"variable label" (the label in the button - it can be anything in quotes)

variable (you can call this anything, one word only) 

functionName (what to do when the label is pressed or mouseOver'ed - in this
case pop-up a window of the specified attributes as follows:
	'windowName', (name for the window) -
	'width=400,height=300, (width and height in pixels) - 
	resizable=1, (resizable? 1=yes) - 
	scrollbars=1, (scrollbars? 1=yes) - 
	location=0, (show URL? 1=yes) - 
	status=0 (show status field? 1=yes)

http://URL-for-form.html

##


<hr>
<center><form>
   <script language="javascript">
   <!-- Based on "Search Satellite", Copyright  1996 by Jason Gurney.  See http://www.j-g.com/search/copyright.html for details.
   // -->
   <!-- Hacked from the specific "Search Satellite" to the generic "buttonForm" Dec 6 1996 T.J.Hardman, Jr.
   // -->

   var variable = null;
   function functionName() {
     variable = window.open('http://URL-for-form.html', 'windowName', 'width=400,height=300,resizable=1,scrollbars=1');
     if (variable != null) {
       if (variable.opener == null) {
         variable.opener = self;
       }
     }
   }
   document.writeln('<input type="button" value="variable label" onClick="functionName()">');
   // -->
   </script>
</form>

Note that in the "opentoolbar" script, in the line

     toolbar = window.open(location.href ,'barWindow','toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,width=400,height=120');
there's this notation (location.href) - this controls the URL displayed in the new window. If you leave it as (location.href) it will simply copy the present URL to the pop-up window. If you write it as ("http://foo.bar.org/directory/page") it will load that page.

So, you say, so what? If in the page which is called into the pop-up, you include the line:

<a href="http://foo.bar.org/directory/page" TARGET="mainWindow">link</a>

then you'll get a window, without location, menubar, status, etc, exactly the same size as the window which called the toolbar, and this window will contain the page called by the link containing the TARGET statement.

This can be fun.

If, however, you use the TARGET= statement from HTML in the main browser window, you will create a pop-up or toolbar which has all of the function attributes as your main browser window, such as the location, status fields, menu bar, etc. This creates an additional drain on machine resources, and plus it's excessive clutter on the screen.

Feel free to steal everything I wrote - add it to your pages, and do your best to make everyone happy about what Netscape Javascript can do for their pages!

But remember, if you're going to do pop-ups and toolbars, be sure to always add a little button at the end of the page which will allow someone to .
Go to the Business MetaIndex Page.
Visit the Computing MetaIndex Page.
Visit the Sciences MetaIndex Page.
Visit the Earth Operations Central District Office. Try a Glimpse HTTP Search (searches HTML content).
Go back to the main EarthOps Homepage.