Page 65 - DCAP202_Fundamentals of Web Programming
P. 65
Fundamentals of Web Programming
Notes in front of the ‘*’, that frame gets that much more relative space. “2*,*” would give 2/3 of
the space to the first frame, and 1/3 to the second.
Example: Setting Frame width and height
There are three ways to specify the width or height of a frame:
As a percentage of the area allotted to the parent frame set.
As an absolute (specific) number of screen pixels (e.g., 250).
As a ‘relative size’.
Example for 3 rows, the first and the last being smaller than the center row:
<FRAMESET rows=”20%,60%,20%”>
Example for 3 rows, the first and the last being fixed height, with the remaining space assigned
to the middle row:
<FRAMESET rows=”100,*,100">
A ‘relative size’ is specified with an asterisk, e.g., ‘1*’, ‘2*’, ‘3*’ (‘1*’ can also be written simply as
‘*’). This is interpreted as follows: after all widths (or heights) specified as percentages or absolute
amounts have been allocated to the corresponding frames, the remaining space is allocated to
frames whose widths (or heights) have been specified as a relative size. The amount of space
allocated to a frame is proportional to the number in front of the asterisk.
Example:
<FRAMESET rows=”30%,400,*,2*”>
<FRAME ... >
<FRAME ... >
<FRAME ... >
<FRAME ... >
</FRAMESET>
Suppose the browser window is currently 1000 pixels high. The first frame gets 30% of the total
height, that is, 300 pixels; the second frame gets 400 pixels, since an absolute amount was
specified. This leaves 300 pixels to be divided between the other two frames. The fourth frame’s
height is specified as ‘2*’, so it is twice as high as the third frame, whose height is only ‘*’ (1*).
Therefore the third frame is 100 pixels high and the fourth is 200 pixels high.
The FRAME Element
The FRAME element defines a single frame in a frameset. It has 7 possible attributes: SRC,
NAME, FRAMEBORDER, MARGINWIDTH, MARGINHEIGHT, SCROLLING, and NORESIZE.
The FRAME tag is not a container so it has no matching end tag.
The attributes of the FRAME element type are as follows:
src=”address”
Specifies the address of the document to be displayed in the frame. When omitted the frame is
displayed as a blank space.
name=”window_name”
The NAME attribute is used to assign a name to a frame so it can be targeted by links in other
documents (These are usually from other frames in the same document.) The NAME attribute is
optional; by default all windows are unnamed. Names must begin with an alphabetic character.
58 LOVELY PROFESSIONAL UNIVERSITY