to home page


Controlling windows    

How To Control How
Windows Open

Many sites have links to windows that open to a predetermined size, with or without controls or pop up when a page loaded (these popup window are called floating palettes and can be useful or can be a damn pain!!)

They rely on Event Handlers & JavaScript to create them (so remember they won't work on older browsers)

Lets begin with a simple example. Click on the form button below and another palette opens

Here is the HTML code

<p align="center"><input type="button" name="anythingyouwant"
value="Open Sesame"
'width=200,height=200 ');">

(composer and frontpage express users should use add HTML functions for this)

The form set up you have seen before. But the onClick function is new. The key JavaScript command is This tells the browser to open up a file in a new window (here "test.htm" in a window with attributes set to a 200 pixel by 200 pixel size)

Notice how there is no scrollbar or menu controls. You can't adjust the size of the box either.

Technically you need to do this

'width=200,height=200,toolbar=no,menubar=no,location=no, directories=no,status=no,scrollbar=no,resize=no'

JavaScript will recognises 1 & 0 as yes and no alternatively.

Luckily both Internet Explorer and Netscape recognise no (0) as a default. (toolbar to directories set various menu bars, then status sets the status bar at the bottom of the window. The scrollbar and resize are self explanatory we hope !!!)

Make sure you don't put in extra spaces
(e.g. scrollbars=0, status=yes) or the effect might not work (esp on Netscape)

Substitute your own target URL (we use test.htm here) and change the options as described earlier. You can also replace anythingyouwant, test.htm and newwindow with any values you want.

(We describe how to close down windows elsewhere)Back to top

you can have a window that pops up when you open a page

To do this we added the onLoad attribute to the <body> tag

'navwindow', 'width=480,height=100');">

(Again composer and frontpage express users should use add HTML functions for this)

The onLoad attribute tells the browser to do the following when the HTML document loads up

Here onLoad tells the browser to open a window for the URL (defined here as the file nav.htm) which the browser then knows as a window called navwindow (you can use your own name).

Okay !! That's the basics !!

But how about adding it to a more ordinary link item like a graphic or text


to see exampleor click here

So how did we do it. Here is the code for the <a> tag used for both

<a href="test.htm" target="newwin"

(note the '' after
is actually two single apostrophies ' not an inverted comma ")

Simply create a link to your target page (here test.htm). Add to this a name for a target (make sure it won't interfere with any frames elsewhere)

Now the sneekie bit !!!

The onClick attribute triggers the JavaScript command as before. But notice how the first set of apostrophies has nothing in it. and the next set has your target frame name (here "newwin") this forces the browser to open a new blank palette window with a frame called newwin and load the href value page into it. (hey it works doesn't it !! - if you can do it better let us know !!!!)

(and once again composer and frontpage express users should use add HTML functions for this)

Back to top

back to Index