If you have not done so already, go ahead and create the HTML documents that will occupy each frame on your page. You can use the HTML documents you created in the previous chapters.
Now you will add to your frameset document the "frame src" tags which will tell the browser which HTML documents to place in each frame:
<html><head><title>Frameset Test</title></head> <frameset cols="200,*"> <frame src="links.htm"> <frame src="information.htm"> </frameset> </html>
This example shows a frameset document which will divide a Web page into two columns, or frames. In the left frame, 200 pixels of space will display the document "links.htm." The rest of the page, the right column, will display the document "information.htm." You can also see the tags used to close a frameset document:
Naming Your Frames
Usually, a Web page contains frames in order to show, or link to, additional information located within the same site. The site The Birch Aquarium is an example of frames being used to link to information within the same site. The menu bar of links pulls information into the middle frame of the Web page when a link is clicked, without disturbing the outer frames of the page.
In order to let the browser know which frame to place the linked information into, you must "name" your frames. If you do not specify which frame is to receive the new information, the menu frame of links will be replaced with the linked information itself, destroying the look and purpose of your framed page.
To name a frame, just place a "name" tag within the "frame src" tag in your frameset document. You can give each frame any name you choose.
<frame src="links.htm" name="menu">
<frame src="information.htm" name="info">
After you name a frame, you can specify which frame you would like the linked information to be placed into by adding the "target" tag, followed by the name of the frame.
Example: <a href="http://www.howstuffworks.com/company.htm" target="info"> Company Information </a>
This tells the browser to display the linked information into the frame named "info."
Saving and Viewing Your Document
Like regular HTML documents, frameset documents are saved with either .htm or .html extensions. Be sure to keep the frameset file in the same folder as the HTML documents that will appear in its frames.
When you open your frameset document in your browser, you should be able to see a divided screen with a separate HTML document within each frame.
In the next section we'll find out how to remove the scroll bars and borders.