5.2 FRAMES

Back To NoFrames Version Next


1. SO WHATS IN A FRAME?


Like Tables, frames may seem scary things at first. Al they are is combinations of 2 or more different HTM files managed by a "frameset" HTM file, which tells the browser how to, and in what order, to display these frames in a browser. You will now find out why it is that I have been getting you into the habit of right-clicking on a page to view the source, as opposed to using "View" then "source" from the toolbar.

To check this out, select "View" then "Source" from the toolbar of your browser now, and have a look at what you see. This is the frameset file for these pages which tells how the frames will be displayed. Now use the right-click mouse method on both the menu on the left and this page (but make sure you click on a blank part of the page). You will see that the menu on the left, and this page are sourced from completely different HTM files! Thus the frameset file you saw, tells the browser to pull in the menu HTM file on the left in a frame that takes up 22% of the browser window, and to pull in this tutorial page in the main frame which takes up 88% of the browser window. Simple as that!

This frame from which you are now reading, is termed a "live" frame, because it is the frame whose content changes when you click on a topic from the menu in the frame on the lef which is located in the "static" frame.


2. CODE FOR THE FRAMESET FILE


A frameset file should be coded in a similar fashion to the below:

<HTML>
<HEAD>
<TITLE>Frameset name<TITLE>
<HEAD>

<FRAMESET BORDER="x" COLS="20%","80%">
<FRAME NAME="frameone" SRC="filename.htm" MARGINHEIGHT="0" MARGINWIDTH="0" NORESIZE SCROLLING="auto">
<FRAME NAME="frametwo" SRC="otherfilename.htm" MARGINHEIGHT="0" MARGINWIDTH="0" NORESIZE SCROLLING="auto">
</FRAMESET>

<NOFRAMES>
you put in information for those who haven't got frame capable browsers in here just so they know what is going on, and what they are missing.
</NOFRAMES>
</HTML>


3. FRAMESET ATTRIBUTES



4. NESTED FRAMES


All you have to do to do nested frames is chuck another FRAMESET element or how ever many you want, in the frameset htm file! An example is below:

<HTML>
<HEAD>
<TITLE>Frameset name<TITLE>
<HEAD>

<FRAMESET BORDER="x" COLS="20%","80%">
<FRAMESET ROWS=""x, x">
<FRAME NAME="frameone" SRC="filename.htm" MARGINHEIGHT="0" MARGINWIDTH="0" NORESIZE SCROLLING="auto">
<FRAME NAME="frametwo" SRC="otherfilename.htm" MARGINHEIGHT="0" MARGINWIDTH="0" NORESIZE SCROLLING="auto">
</FRAMESET>

<FRAME NAME="framethree">
</FRAMESET>

<NOFRAMES>

you put in information for those who haven't got frame capable browsers in here just so they know what is going on, and what they are missing.

</NOFRAMES>

</HTML>

Inserting the variables as discussed under attributes earlier should give you frames that look like:

Frameone Frametwo
Framethree

Expecting there would be more were we? Well there aint! You don't need any code in the HTML pages you want pulled into each frame (though you may need to insert a TARGET="x" attribute and the relevant variable as discussed earlier in some of your link <IMG. tags in other pages so the page gets pulled into the frame it is supposed to!). The rest is up to you, so experiment away!

Oh, and note that you will obviously need a <FRAME... element and its associated attributes for every other frame you wish to have on the page. But don't go nuts - 3 is normally enough in itself! Vistors can tend to get irritated by frames so only use them anyway, for very good reason as I have in this HTML tutorial for the index on the left. Right, onto another nifty gizmo...........



5. FLOATING FRAMES


Nope, I am not referring to the effect after one has partaken of rather too much alcohol, I am talking nifty useful gizmo's here! Ever since MIExp 3.0 you have had this option. It is where the frame appears to be part of the actual web page itself, rather than in its own separate window as we have been doing them before. There is one problem: Netscape Navigator cannot deal with them yet, so don't go overboard with them, shipmates! I will mock up a little one for you to see below (sorry Netscape Nav. users as you won't see the below at all, only the code!):



And the code I used for this:

<CENTER>
<IFRAME NAME="Afloatyframe" WIDTH="200" HEIGHT="200" SRC=*quot;HTMLmenu.htm" BORDER="2" NORESIZE HSPACE="2" VSPACE="2" SCROLLING="yes">

</IFRAME>
</CENTER>

So just stuff this code in with whatever variables and other attributes (as dealt with under "normal" frames) you want, and you've done it! You do need borders, else your handywork will not be obvious! You just put in whatever filename you want. In this case I have just loaded up the exact same menu file I have sitting in the big frame on the left of the browser window! That's all about frames, folks!


NEXT: Wanna remain in good form....?

Back To NoFrames Version Next

eyesborder
COPYRIGHT INFORMATION: All Rights Reserved. No part of this HTML tutorial may be reproduced, stored in a retrieval system, or transmitted, in any form or by any means, electronic, mechanical, photocopying, recording, or otherwise, without the prior permission of the copyright owner, Didi Austin, who may be contacted using the link below.
© 1999 Didi Austin
eyesborder