Main Page. VBA, ASP, Visual Basic 6.0, and VB.net. Visual C++, C#, C++, C. HTML and maybe javascript. Forum,Games and Jokes, other stuff. Submit a Tutorial Today!

Lesson 8: How to Use Frames.

Frames are something that most HTML users in the past have learned before tables. Frames are one of the older varieties of organizing your data, and I do not recommend them, because they have sizing issues and other issues that are browser incompatible. Tables do not have these problems.

Even though frames are old, an accomplished HTML programmer should know how to program them. In this tutorial, I will show you how to program your site into frames.

Framesets.

Unlike other websites where you start out with the HTML, HEAD tags and then the BODY tags, you don't use a BODY tag in your main frameset. A frameset is where all the different frames are shown.

Frames are different from tables in a few ways. First, frames are each their OWN web page. This can make editing your web site a bit easier. Now I will show you how to make a frameset.

You start off right after the </HEAD> tag with a <FRAMESET> tag. It is closed by the </FRAMESET> and inside of it are <FRAME></FRAME> tags. Here is a basic example.

<Frameset rows="25%,*">

<Frame name="toolbarframe" src ="toolbar.html">

<Frame name="mainpage" src="main.html">

</Frameset>

This would create two frames, one occupying 1/4th of the screen and the other occupying the rest.

Let me give you the information behind the frameset tag.

<FRAMESET></FRAMESET> - Used to create a frameset.

rows = defines the rows in the frames use a * to let the frame have any left over space.

cols = same as rows but for cols you can use a * for it too.

Now let me acquaint you with the FRAME tag

<FRAME> - Used inside of a frameset tag to specify the frames.

src = the document displayed in the frame.

name = the name that hyperlinks use to reference this frame (more on this later)

Hyperlinks and Frames.

Ok, you have your frameset with the toolbar on one side and the main page on the other. What if you want the toolbar to have a link display in the main window? Have no fear, there is a special attribute of the Anchor, <A>, tag that will let you do this. It's called target. Basically, whenever you want to have a link reference to another frame you do something like this.

<A href="wherever" target=thenameoftheframetodisplayin></A>

That will load it into the specified frame.

Things to Note About Frames.

Frames cannot be inside of a body tag. There is another frame, which will be in another tutorial, called an IFRAME that can be used for this.

Frames are old, so I would recommend staying away from them. Rarely do you see people using frames on a good website.


<-Previous Lesson
 

Binary Central by Anman: "http://www15.brinkster.com/anman/"