home    egovision html tutorials    tuorials home

Lesson 8. Further Frames.

Nested Frame Sets.
You can extend the notion of frames further by putting FRAMESETs within FRAMESETs. This allows you to mix rows and columns at the same time.

Open the myframes.html document from the previous tutorial and make the following changes:

          <HTML>
          <HEAD>
          <TITLE>My Frame Set</TITLE>
          </HEAD>
          <FRAMESET rows="
50%,50% >
                 <FRAME SRC="fileone.html">
                      
<FRAMESET cols="25%,75% >
                            <FRAME SRC="filetwo.html">
                            <FRAME SRC="fileone.html">
                      </FRAMESET >

          
</FRAMESET >
          </HTML>


Here we have replaced the source of the second frame with another FRAMESET. This code splits the screen in half horizontally, loads fileone.html into the top half,splits the bottom half vertically
into a quarter and three quarters, loads filetwo.html into the left (smaller) frame and fileone.html into the right (larger) one.

Try it, it should look something like this:

There's no limit, you could go on dividing and dividing, although I can't think of any reason to do so.

Naming Frames.                       <FRAME name=" ">
Frames can be allocated names and it is good practice to name all frames at all times. Just add the name attribute to the <FRAME> tag. If for example you were splitting the screen vertically you might do this:

                   <FRAME SRC="fileone.html" name="left">
                   <FRAME SRC="filetwo.html"
name="right">

There are many good reasons for this the next section de
als with the most obvious one.


Linking Between Frames. <A HREF=" " TARGET=" "> </A>
The main reason for naming your frames is to define them as targets for your hyperlinks.


The following files are included in the "furtherhtml.zip" archive and will extract to a subdirectory called "target"
If you did not download this file in lesson 7 you may click here to do so now.



Once again open the myframes.html document and make the following changes:

          <HTML>
          <HEAD>
          <TITLE>My Frame Set</TITLE>
          </HEAD>
          <FRAMESET rows="50%,50% >
                 <FRAME SRC="fileone.html" name="tophalf">
                      <FRAMESET cols="25%,75% >
                           <FRAME SRC="filetwo.html" name="bottomleft">
                           <FRAME SRC="fileone.html" name="bottomright">
                      </FRAMESET >

          
</FRAMESET >
          </HTML>


Now open filetwo.html and add the following:

          <HTML>
          <HEAD>
          <TITLE> filetwo</TITLE>
          </HEAD>
          <BODY BGCOLOR="#00FF00" TEXT="#000000">
          <H3>File Two Content</H3>
          <A HREF="filetwo.html" TARGET="tophalf">Test Link</A>

          </BODY>
          </HTML>


By doing these two things you have given names to each of the screen areas and created a link in filetwo.html that will load another copy of filetwo.html into the top area.

Open myframes.html in your browser and click the link that you've just created, the result should be similar to that shown below.
filetwo.html has been loaded into the "tophalf" area as we specified.


Escaping From Frames - Special TARGET names
Although you can call your frames almost anything you like there are certain names that are "reserved" in HTML for specific purposes.


Preset TARGET names are.....
_top - loads the link into the full browser window
(great for getting people unstuck from FRAMESETs).

_blank - loads the link into a new blank window.

_self -loads the link into the same window.

_parent - loads the link into the parent of this document.

next lesson
 
egovision


Tutorial Site Map

HTML Resource Centre

Lesson 6
Introducing Frames
  • What are Frames?
Lesson 7
Creating a Frameset
  • Setting out frames, Basic syntax
Lesson 8
Further Frames
  • Nested Frame Sets
  • Naming Frames
  • Linking Between Frames
  • Escaping From Frames
Lesson 9
Customising Frames
  • Frame Attributes
  • NOFRAMES tag
Lesson 10
Floating Frames

(HTML4 Netscape 5 &
Microsoft Explorer ONLY)
  • IFRAME - Breif History
  • Using IFRAME