IST129: Chapter 12 - Frames

Like tables, frames allow you to segregate content for better readability of your HTML documents. Unlike tables, however, frames are individually scrollable and printable. Think of frames like window panes - each pane is separated visually and possibly physically from every other pane, yet all the panes together comprise just a single window. So it is with frames and your HTML document.

The documents that fit inside each frame (one document per frame) are actually separate HTML document files.

Please keep in mind that frames can only be viewed if the browser can handle frames. Thankfully, most browsers can handle frames. Unfortunately, Homepage can not handle frames!


Click here for frames (picture)
Click here for another frames example (picture)

<frameset>...</frameset> tag:

The frameset tag encloses the definitions for frames in your HTML document. Attributes used include:

<frame> tag:

The frame tag defines the HTML document that is to be displayed within a frame. Attributes used include:

<noframes>...</noframes> tag:

The noframes tag contains the text to display to a user should they (1) be using a browser that does not support frames or (2) the WWW site that your pages are on does not allow/support frames (ala HOMEPAGE).

So, do you wonder how a browser that can not handle frames knows what to with the <noframes>...</noframes> tag?

The answer is simple. Browsers ignore tags that they don't know about, right? A browser that can not handle frames ignores the <frameset> and <frame> tags as well as the <noframes>...</noframes> tag, right? Well, what the browser does not ignore is dumb text between the beginning and ending <noframes>...</noframes> tags. Voila! Now users with browsers that can't handle frames will get a textual message as the browser skips all the frame-related tags.

So, how many sets of <noframes>...</noframes> tags do you need in your FRAME document no matter how many nested <<frameset>...</frameset> you use? ... Ta-da! Only one set of <noframes>...</noframes> tags is needed because all other frame-related tages will be ignored.


Your task...

  1. Create 4 HTML files called:htm1.htm, htm2.htm, etc. Within each of the HTML files put a H1 tag to visually ID each file to the reader.
  2. Create a frame document called "frame.htm" to define 4 frames of equal size, 2 on the top and 2 on the bottom like this (picture).
  3. Run the frame document.
  4. Modify the frame document to display the 4 frames as:

Target frames

You may dynamically load HTML files into named frames. This implies that you have a table-of-contents HTML file that contains links to other HTML files. It is those other HTML files that you will load into some target frame on-the-fly as the user selects different topics from your table-of-contents frame. Click here for an example or here for a picture.

Your task...

Using the HTML files you created above, create a table-of-contents HTML file called "toc.htm". Within "toc.htm", use an unordered list to create hyperlinks to each of the HTML files.

Your frame document must use the name attribute mentioned above.

Specifically, your FRAME document will have one FRAMESET tag with 2 FRAME tags. The second FRAME tag will have the attribute NAME="DOC".

The table-of-contents document ("toc.htm") must have the following anchor tag for the hyperlink:

     <a> href="xxx.htm" target="DOC">...</a>


Floating Frames

Floating frames are respected only by MS-IE using the IFRAME tag. They allow you to create a frame outside of the FRAMESET statements in the FRAME document. Click here for an example or here for a picture.