3.4 Frames

3.4.1 Basics about Frames

If you go to any homepage in the internet that leads to more than just a few documents, changes are that you will encounter frames. Just try the link to the homepage of this script!
Use the scroll bar on the right hand side: Only parts of what you see moves; some parts of the screen are not involved.
What you do when using frames is to divide the screen in a number of independent areas - the "frames". Obviously, there must be at least 2 frames, but you can make as many frames as you like - with fixed sizes and positions on the screen.
What you see inside each individual frame is something you decide; the frames as such are completely independent of each other.
Often, however, there are some small frames and a main frame. What you do in a small frame, e.g. clicking on some kind of index, then changes what happens in the main frame.
But that does not contradict the above statement: The frames are indeed independent of each other - the dependency you see concerns the contents of frames, and this dependency was designed by creating links between frames.
That has some important consequences:
If you want to display a document on your screen by loading it via a link, you must tell the browser in which one of your independent frames the document should be displayed. This information is an attribute to a link tag!
If you load a document from somewhere else that may have frames of its own via a link, you will get frames within frames: One of your frames - the one the other document is loaded into - now is divided into more independent parts of the screen - the frames of someone else that you now have within one of your frames. So again, you must specify an attribute to the link tag to avoid this.
Now lets see how a frame is made.

3.4.2 Constructing a Frame

Constructing a frame in source code is fairly messy; but HoTMetaL provides an easy to use short cut. So let's start:
You must construct a frame on an empty page, but not on any empty page.
Open a new page (Do not click on the "empty page" button, chose "New" in the File menu, and go to "frames page" in the choice that pops up.
You now have a choice for some standard frame sets - that is the word for the collection of frames you are to establish.
Select one - e.g. the frame set with a head frame, a side frame, and a main frame (called "header and contents").
You will now get a page with the frames displayed
Now look at the symbols at the bottom of the page. You see a new key that is activated - the "frame on view" key. Now press the "tags on view" key.
All you see now is a page with some tags saying <Frameset>, <frames>, and <noframes> within a comment tag. The comment tag, again, is for keeping browsers in line that cannot support frames.
The other two remind you that a frame set is something different from a frame; it must be specified independently.
Lets look at the frame set first. The best way to find out, is to put your cursor in the corresponding <frameset></frameset> tag and press F6.
The first attributes are "ROWS" and "COLumns"; there might be a number followed by a comma followed by an asterix in "ROWS". e.g."100,*".
This obviously gives the width of the vertical frame on the left hand side in pixels. It actually gives the width of both columnar frames; the asterix simply tells the browser to take whatever is left for the frame to the right of the attributed one.
If you have more than two vertical frames, you have more than two numbers; if you give all numbers (no asterix), you might confuse the browser because you might specify something that can't be done.
If you look at your frame set in the source code, you will find the "100,*" entry there too. It is clear that you change the size of this frame within the frame set if you change the number.
Since there are easier ways to adjust the size of your frames compared to doing it the direct way, we will not discuss this here.
Now lets see what kind of attributes we find for the <frame></frame> tag
The first thing we should do is to give the frame a name. If you are not sure which tag contains which frame, go to the "frame view" instead of "tag view" and simply click in the frame you want to specify. the border lights up; now hit the F6 key. The attribute list now popping up is the list for the frame you selected.
Good names are, e.g. "headframe" for the one at the top, "sideframe" for the one at the side, and "mainframe" for the big one. You can use any names you like, but do give names now.
We will come back to the other attributes, but we have must do something else before.
We must store our frame set! And there is a rigid rule for that!
Since a frame set is practically always the first page of a HTML project that a browser should load, it carries the fixed name for that page which is "index.html" or "index.htm" - the trend goes to the four letter prefix.
The term "html project" has also a defined meaning: It is the ordered and internally linked collection of HTML documents (including style sheets, graphics, videos, audios, and everything else) that has to go over the net to a user.
And since the first page must be on the top of the hierarchy of folders and files, you store your frame set with the file name "index.html" in your top file.
If you do that, any browser, if only given the basic address of your project ending in a slash (/), will automatically open the page named "index.html" - which is what you want.
Now we have a frame set, but so far it is empty. Lets try to get some text inside the frames.
Go to your frames and try to write something into a frame. This seems to be not possible, because there is no cursor in the "frame view" display. Well, try the tag view and try to write in the frame tag. Not possible either.
That is so, because the contents of a frame are always loaded into the frame via a link to the document you want to have in the frame.
We will discuss how you link documents and frames in the next subchapter, here we finish by learning how you format the frame set.
The essential points are the sizes of the frames, the kind of border between frames, and what the browser is supposed to do if what you load into a frame does not fit into the available space.
Changing frame sizes is easy: Just move the borders with the mouse. In his case - in contrast to tables - it is a good idea to do it this way. After you found the sizes you like, you may want to give it in percent and not on pixels - it is up to you; just change the settings from, e.g., "70,* to "10%,*" (with F6 in the proper frame set tag) and resize again by directly moving the borders
Setting border line width and color is done by clicking into the frame you want to adjust, using F6 directly, and writing the borderline size for the attribute "BORDER" and by selecting the color the usual way for the attribute BORDER COLOR. You must chose "ALL" in the attribute menu to see those options!
The last important attribute is "SCROLLING". If you set it to "no" in your mainframe (where your stuff is supposed to be), nobody will be able to see anything that is not on the screen - there will be no scroll bars. Same if you enable "noresize" for the "NORESIZE" attribute. So be careful with these attributes!


index.gif zurueck.gif