The structure of a framed site is as follows:
The home (index) page starts with a <FRAMESET>....</FRAMESET> element
which contain some <FRAME> tags.
The "information" within that element is all held by attributes inside
the tags; there is no renderable text to display.
That part should end with a <NOFRAMES>....</NOFRAMES> element; between those tags you can put any conventional HTML code, even a whole page.
About the only sensible use for these frames is to be able to maintain one "sub-window" permanently displaying the main index or contents list of a site, while a second sub-window is used to display whatever pages (one at a time) you link to from the index.
<HTML>
<HEAD><TITLE>My Web Site (you have been framed)</TITLE></HEAD>
<FRAMESET COLS="25%,*">
<FRAME SRC="synop.html">
<FRAME SRC="intro.html" NAME="main">
<NOFRAMES>
<H1>Contents</H1>
<UL>
<LI><A HREF="intro.html"> Page 1: </A> Introduction
<LI><A HREF="page2.html"> Page 2: </A> Useful Info.
<LI><A HREF="page3.html"> Page 3: </A> Useless Info
</UL>
</NOFRAMES>
</FRAMESET>
</HTML>
<HTML> <HEAD><TITLE>My Web Site: Contents</TITLE></HEAD> <BODY> <H3>Contents</H3> <P> <A HREF="intro.html" TARGET="main">Page 1:</A><BR> Introduction <P> <A HREF="page2.html" TARGET="main">Page 2:</A><BR> Useful Info. <P> <A HREF="page3.html" TARGET="main">Page 3:</A><BR> Useless Info </BODY> </HTML>
<HTML> <HEAD><TITLE>My Web Site: Introduction</TITLE></HEAD> <BODY> <H2>Introduction</H2></BODY> </HTML>
__________________________________________________________________________
__ | _ _ _ _ _
/ _ _ |_ _ _ |_ | | |_ __| |_ _ _____ __| |_ _ __| |_(_)___ _ __
\__(_)| )|_(-`| )|_/) | | | '_ \ |_| '_/ _ \/ _` | |_| / _/ |_| / _ \ '_ \
| |_|_| |_\__|_| \___/\__,_|\__,_\__\___|_\___/_| |_|
|
Page 1: |
------- |
Introduction |
|
Page 2: |
------- |
Useful Info. |
|
Page 3: |
------- |
Useless Info |
|
|
______________________|___________________________________________________
__________________________________________________________________________
___ _ _
/ __| ___ _ __ | |_ ___ _ __ | |_ ___
| | / _ \ | '_ \ | _| / _ \| '_ \ | _| / __|
| |__ ( (_) )| | | || |__( __/| | | || |__ \__ \
\___| \___/ |_| |_| \___|\___||_| |_| \___||___/
o Page 1: Introduction
--------
o Page 2: Useful Info.
--------
o Page 3: Useless Info
--------
__________________________________________________________________________
The COLS attribute in the <FRAMESET> splits the screen into two columns, one of 25% of screen width, and the second occupying "the remainder".
The second <FRAME> tag includes a NAME attribute.
The section between <NOFRAMES> and </NOFRAMES> is conventional HTML for a home page.
The page "synop/html" looks just like a "conventional" HTML page; but note that all of the <A> anchors include a TARGET="main" attribute to ensure that those linked pages will load into the main right-hand area of the screen (not into the narrow "contents" strip").
The page "intro/html" is a conventional HTML page.
There are just three "new" tags:
The two main attributes are ROWS= and COLS=, dividing the screen up into
rows and columns respectively. It is permissible to have both attributes
in the same one tag to divide up into a tabular grid; but it is probably
simpler to use nested FRAMESETS with just one attribute each.
The "value" of a ROWS or COLS attribute has the form of a comma-separated
list enclosed in quotes.
Each item in the list can be one of:
You need to be very careful to make sure that:
The NOFRAMES section will normally be positioned immediately before the
last/outermost (closing) </FRAMESET> tag
(this placing is not obligatory, but my recommendation).
Logically speaking, <NOFRAMES> could be followed by a <BODY> tag, and </NOFRAMES> preceded by a </BODY> tag; but received wisdom is that some versions of Netscape don't like that, so it's probably better to omit <BODY> tags (in a frames-setting document)-- this means that you won't be able to set text colours or backgrounds (which probably results in a less over-the-top page anyway ;-)
In a site with no frames, a hyperlink is simply something like
<A HREF="page2.html">Next page</A>
and clicking on it fetches that page
and loads it into the one and only frame/window of the browser.
But with a framed site, there will always be room for ambiguity as to WHICH frame the fetched page should appear in!
Note that if the current frame has no parent, then "_parent" is the same as "_self", and "_self" is the same as "_top".
"_blank" will open a new window while preserving the "calling" one.
If an explicit TARGET is not specified, there are some rules for what the "default" target frame should be:
So far, I've only said that the TARGET= attribute occurs in <A> tags; in fact, it can occur in other tags which can contain a HREF= attribute, in particular, in an <AREA> tag within a <MAP> definition block, and also within a <FORM METHOD=GET ACTION="http://reference"> tag.
This causes chaos on a framed site!
That page would have been loaded into one of the frames, and so the link
given above would load "index/html" into that frame; "index/html" would
then sub-divide that frame up into further sub-frames . . . . . Arrghh!!
Using <A HREF="index.html" TARGET="_top">Back to HomePage</A>
avoids that "nesting" problem, but is NOT a satisfactory solution as the
browser now has to re-create and re-fetch all the frames; including the
"navigation" frame, and the whole point of using frames is that that frame
is supposed to remain unchanged and not need refreshing!
Creating a site which is viewable by both frames-implementing browsers AND non-framing browsers requires quite a bit of care if it is to be equally informative and navigable under all conditions!
The code below will work, but needs padding out to make a real site!
<HTML>
<HEAD><TITLE>My Home Page (frames-compatible)</TITLE></HEAD>
<FRAMESET ROWS="100,*">
<FRAME SRC="logo.html" SCROLLING=NO>
<FRAMESET COLS="25%,*">
<FRAME SRC="navig.html" SCROLLING=AUTO>
<FRAME SRC="hello.html" NAME="main" SCROLLING=YES>
</FRAMESET>
<NOFRAMES>
<H2>Welcome to my Home Page!</H2>
<EM>This site can be viewed equally well with or without frames</EM>
<UL>
<LI><A HREF="about.html">About me, and my Hobbies</A>
<LI><A HREF="softw.html">Programs & Software </A> to download
<LI><A HREF="links.html">Links </A> to other interesting sites
</UL>
</NOFRAMES>
</FRAMESET>
</HTML>
<HTML> <HEAD><TITLE>(Logo for my web site)</TITLE></HEAD> <DIV ALIGN=CENTER> <IMG SRC="mylogo.gif" ALT="My logo should have been here"> </DIV></HTML>
<HTML>
<HEAD><TITLE>My Home Page (Contents)</TITLE></HEAD>
<BODY>
<UL>
<LI><A HREF="about.html" TARGET="main">About me</A>,<BR>
and my Hobbies
<LI><A HREF="softw.html" TARGET="main">Programs & Software</A><BR>
to download
<LI><A HREF="links.html" TARGET="main">Links</A><BR>
to other interesting sites
</UL>
</BODY></HTML>
<HTML>
<HEAD><TITLE>Welcome to my Home Page</TITLE></HEAD>
<BODY>
<CENTER>
<H2>Welcome to my Home Page!</H2>
<EM>This site can be viewed equally well with or without frames</EM>
</CENTER>
<NOFRAMES>
<UL>
<LI><A HREF="about.html">About me, and my Hobbies</A>
<LI><A HREF="softw.html">Programs & Software </A> to download
<LI><A HREF="links.html">Links </A> to other interesting sites
</UL>
</NOFRAMES>
</BODY>
</HTML>
<HTML>
<HEAD><TITLE>All about me</TITLE></HEAD>
<BODY>
<CENTER>
<H1>All about me</H1>
<IMG SRC="photo.jpeg" ALT="Mugshot">
</CENTER>
<DL>
<DT>Age
<DD>56, going on 18
<DT>Hobbies
<DD>Writing incomprehensible HTML tutors
</DL>
<HR>
<A HREF="hello.html" TARGET="main">Back to Home Page</A><BR>
<NOFRAMES>
<A HREF="softw.html">Programs & Software </A> to download<BR>
<A HREF="links.html">Links </A> to other interesting sites<BR>
</NOFRAMES>
</BODY>
</HTML>
<HTML> <HEAD><TITLE>My Software</TITLE></HEAD> <BODY> <CENTER> <H1>My Software</H1> </CENTER> <UL> <LI><A HREF="beep.zip">!Beep</A> Makes a beeping sound (63MB) </UL> <HR> <A HREF="hello.html" TARGET="main">Back to Home Page</A><BR> <NOFRAMES> <A HREF="about.html">About me</A>, and my Hobbies<BR> <A HREF="links.html">Links </A> to other interesting sites<BR> </NOFRAMES> </BODY> </HTML>
<HTML> <HEAD><TITLE>My favourite Links</TITLE></HEAD> <BODY> <CENTER> <H2>My favourite Links</H2> </CENTER> <UL> <LI><A HREF="http://www.acorn.co.uk" TARGET="_top">Acorn</A> <LI><A HREF="http://www.argonet.co.uk" TARGET="_top">Argonet</A> </UL> <HR> <A HREF="hello.html" TARGET="main">Back to Home Page</A><BR> <NOFRAMES> <A HREF="about.html">About me</A>, and my Hobbies<BR> <A HREF="softw.html">Programs & Software </A> to download<BR> </NOFRAMES> </BODY> </HTML>
The <HEAD> section of "navig/html" could have included an additional <BASE TARGET="main"> tag so that the individual TARGETs could be omitted from the <A> links; but I'm never too happy about using <BASE> tags on pages which might be moved around and viewed from different "servers", and equally I don't know how trustworthy browsers are in obeying that tag/attribute combination.
Clearly, this "site" has a number of files missing
("mylogo/gif", "photo/jpeg" and "beep/zip" for example);
and the two <IMG> tags should have WIDTH= and HEIGHT= attributes.
Nevertheless, it should work; although I've found one oddity:
If a frames-implementing browser comes across a <NOFRAMES> section
within the <BODY> section of a page, it is SUPPOSED to skip it
(and I've used that in an attempt to suppress redundant index links);
but I seem to get them still appearing on both ArcWeb-with-frames
and Acorn/VoyBrowse :-[ Oh well, you can't win 'em all!
Some authors will create two complete versions of a site, one with frames
and one without, because ideally the pages will be not quite identical
in the two versions; clearly this makes for unwanted extra work.
This probably is yet another reason for avoiding creating framed sites
unless absolutely necessary!
Up to Contents/Index . . . . . . . . . . . Back to Tutorials page . . . . . . . . . . . Back to Home Page