Saturday 28 September 2013

Using HTML Frames on Right, Left, Top and Bottom of a Website

The Top/Left/Right/Bottom frame is perfect for placing a banner at the top of the page, footer and copyright statements at the bottom of the page and yet allows your web site visitors traverse your web site using the left an right frames.  It's also good to place the title of your web site and keep the title visible throughout your entire site.
The Frames code for a Top, Left, Right and Bottom Frame consists of Five HTML files.   First, is the Control HTML file which also contains the HTML for the web page to support browsers that do not support frames. Second is the source for the top frame. Third is the Source for the Left Frame.  Fourth is the source for the Right Frame and finally the source for the bottom frame.  Below is an example of the HTML for all five files to create this type of a frame:
Controller HTML File:
<html>
<head>
<title>Controller HTML File</title>
</head>
<frameset rows="64,*,64">
<frame name="top-frame" scrolling="no" noresize target="right-frame" src="top-frame.html">
<frameset cols="150,*">
<frame name="left-frame" target="right-frame" src="left-frame.html">
<frame name="right-frame" src="right-frame.html">
</frameset>
<frame name="bottom-frame" scrolling="no" noresize target="right-frame"
src="bottom-frame.html">
<noframes>
<body>
<p>This page uses frames, but your browser doesn't support them.</p>
</body>
</noframes>
</frameset>
</html>

Top Frame HTML File (Save this file named top-frame.html):
                                                                           top-frame.html
<html>
<head>
<title>Top Frame</title>
<base target="right-frame">
</head>
<body>
<p>This is the Top Frame</p>
</body>
</html>

Left Frame HTML File (Save this file named left-frame.html):
                                                                    left-frame.html
<html>
<head>
<title>Left Frame</title>
<base target="right-frame">
</head>
<body>
<p>This is the Left Frame</p>
</body>
</html>


Right Frame HTML File (Save this file named right-frame.html)
                                                                  right-frame.html
<html>
<head>
<title>Right Frame</title>
</head>
<body>
<p>This is the Right frame</p>
</body>
</html>

Bottom Frame HTML File (Save this file named bottom-frame.html)
                                                              bottom-frame.html
<html>
<head>
<title>Bottom Frame</title>
<base target="right-frame">
</head>
<body>
<p>This is the Bottom Frame</p>
</body>
</html>


The Web page you will call is going to be the Controller Frame.  The Controller frame will load up the other two web pages into the left and right frames based upon the src tag in the Control Frame HTML.  In the above example, be sure all five web pages reside in the same directory and are named accordingly.

No comments:

Post a Comment