TAG:  frameset

<frameset> ... </frameset>
Available in versions: 4.0
Browser compatibility: Explorer 4, 5  Netscape 4, 6
 
The <frameset> tag serves as a container element to hold a collection of frames. This tag determines the number of frames, whether the frames are to be of a column or of a row configuration, and sets the spacing for either case. In fact, you must specify either a column or row configuration using either the rows or cols attribute (but not both).
 
When you are using the framset tag, you absolutely must not use a body tag. The frameset tag is used in place of the body tag. However, you can use the iframe tag to create inline frames within a body element.
 
The only tags that are valid inside the frameset tag are the frame, frameset, head, and noframe. Note that you can nest frameset tags inside of frameset tags. Therefore, an HTML document can contain numerous frames. This opens the possibility of creating complex and imaginative page displays (however, always remember to keep the page user friendly).
 
The closing tag is mandatory.
 
Core Attributes
 
class    id    style    title
 
Attributes
 
cols
The cols attribute is used to set the number of column frames in a frameset element. This is done indirectly since you never provide the actual number of columns. Rather, this attribute is a quote-enclosed, comma-separated list of values that specify the width assigned to each frame. The number of values in the list determines the number of frames. For example, if you have three values, then you are expected to have three frames. These values can be:
  • a percentage of the window width
  • an integer number of pixels
  • either of the above methods plus the asterisk *
The asterisk is used to proportionally assign leftover spacing. A 3* value has three times the proportion than a single *.
 
Possible examples are:
Code:
<frameset cols="40%, 60%" >
<frameset cols="20%, 50%, 30%" >
<frameset cols="20%, 20%, 20%, 20%, 20%" >
<frameset cols="100, 100" >
<frameset cols="50, 75, 150" >
<frameset cols="150, * ">
<frameset cols="*, 50%, *, * ">
<frameset cols="3*, *" >
<frameset cols="20%, *, 2*" >
for two column frames
for three column frames
for five column frames
for two column frames
for three column frames
for two column frames
for four column frames
for two column frames
for three column frames

If you use the cols attribute, you cannot use the rows attribute.
 
onload
The onload attribute is an event that allows a JavaScript code to execute when the frame is first loaded by the browser.
 
onunload
The onunload attribute is an event that allows a JavaScript code to execute when the frame is unloaded by the browser.
 
rows
The rows attribute is used to set the number of row frames in a frameset element. This is done indirectly since you never provide the actual number of rows. Rather, this attribute is a quote-enclosed, comma-separated list of values that specify the height assigned to each frame. The number of values in the list determines the number of frames. For example, if you have three values, then you are expected to have three frames. These values can be:
  • a percentage of the window height
  • an integer number of pixels
  • either an integer of the above methods plus the asterisk *
The asterisk is used to proportionally assign leftover spacing. A 3* value has three times the proportion than a single *.
 
Possible examples are:
Code:
<frameset rows="40%, 60%" >
<frameset rows="20%, 50%, 30%" >
<frameset rows="20%, 20%, 20%, 20%, 20%" >
<frameset rows="100, 100" >
<frameset rows="50, 75, 150" >
<frameset rows="150, * ">
<frameset rows="*, 50%, *, * ">
<frameset rows="3*, *" >
<frameset rows="20%, *, 2*" >
for two row frames
for three row frames
for five row frames
for two row frames
for three row frames
for two row frames
for four row frames
for two row frames
for three row frames

If you use the rows attribute, you cannot use the cols attribute.
 
This example creates five frames, each with a different background color.
 
Code:
<html>
<head>
<title>frames example</title>
</head>
<frameset cols="50%, 50%">
   <noframes>
      To be viewed properly, this page requires frames.
   </noframes>
   <frameset rows="33%, 33%, *">
      <frame src="html_frames_red.html">
      <frame src="html_frames_orange.html">
      <frame src="html_frames_yellow.html">
   </frameset>
   <frameset rows="50%, 50%">
      <frame src="html_frames_green.html">
      <frame src="html_frames_blue.html">
   </frameset>
</frameset>
</html>

 
Output:
Click here to see the output of this frames example in a separate window.
 


Copyright 1999-2001 by Infinite Software Solutions, Inc. All rights reserved.
Trademark Information