S.B.C.C. -> Computer Science -> Courses -> COMSC 111 -> Class Notes


Frames

What Frames Are...

Frames are created when the browser window is split horizontally or vertically into two or more sections. Frames have various uses, but they are most typically reserved for providing a static area for display while the content changes. Common uses for that static area are for navigation bars, table of contents, or figures with many types of data to display.

Frameset Definition

Frames are defined by one or more framesets. Framesets are just a set of HTML tags which replace the <body></body> tags in an HTML document. A frameset has the form shown below:

<frameset options>

... Frame Definitions ...

</frameset>

The frameset options are shown in the table below. Bear in mind that not all of the items make sense when put together. Note that sizes are give by a number when referring to pixels and by "%" when referring to percentage of the screen allotted to display the item. For example a row can be specified by <frameset row=100,25> for a frame 100 pixels by 25 pixels. If you put <frameset row=%20,%80> then you would have one frame 20 percent of the allowed area wide and the other frame 80% of the area wide. Numbers are indicated by the text x1,x2,x3,etc.

Frameset Option Function
ROWS=x1,x1,... Specifies the number of rows used for each frame in pixels or percentage. The number of xn items given indicates the number of rows. A "*" indicates a relative size.
COLS=x1,x1,... Specifies the number of columns used for each frame in pixels or percentage. The number of xn items given indicates the number of columns. A "*" indicates a relative size.
FRAMEBORDER="yes" Set to "yes" (include double quotes) to give you a border between frames. When set to "no", it doesn't show the border.
BORDER=x1 Specifies the width of the border in pixels.
BORDERCOLOR=#x1x2x3x4x5x6 Specifies the color of the border in the same way as the body color.

Frame Definition

The frameset tags indicate how many rows (or columns) there are in a given frame. To actually create the frames you have to declare the same number of <frame> tags as there are rows (or columns) in your frameset declaration.

The basic declaration is to place an HTML document into a frame. This is done with the SRC option of the frame tag:

<frame src=URL>

This places whatever the URL points to inside of the frame. Typically it is a page but it can be more than that. It can also be another frameset. This is how you can embed frames within frames. This technique is marginal since you're consuming so much screen space. Other frame options are given below.

Frame Option Function    
NAME="string" Names the frame making it an object for TARGET options on anchors. Reserved names are "_blank", "_self", "_parent", "_top"    
MARGINWIDTH=x1 Width of frame margin. MARGINHEIGHT=x1 Height of frame margin.
SCROLLING="YES" Determines if the frame scrolls. "YES" - Frame always has scroll bars, "NO" - Frame never has scroll bars, "AUTO" - If the data is larger than one page scroll bars are added automatically.    
NORESIZE Cannot resize frame.    
FRAMEBORDER="yes" If a border should be shown between frames.    
BORDERCOLOR=#x1x2x3x4x5x6 Determines the frames color similar to changing the body color.    

Silliest Command

<NOFRAMES> - Whatever is put between these tags is ignored by browsers which support frames. There are only very specialized cases where this would work. Basically it works only for non-graphical browsers (like Lynx).


Last Updated: February 25, 1998
Author: Dean Nevins <dn@picard.sbcc.cc.ca.us>