The next command that we will discuss is the commands to put frames on your web page. Frames can be used to do almost anything. Although frames are a great way to organize information and keep a person never a click away from any part of your page, they do not look good when used in excess. For example, I went to a page one time that had 6 frames on it and the main source of information was in a little tiny frame in the middle. You always want the frame that is the focus to be the biggest and easiest to see because if it is not then people will not be sure what to look at when they go to your page. The good thing about frames is that a person could click in one frame and the action would happen in another frame or in a new browser window. Frames are a series of commands that signal the browser to put different HTML documents in their specified frame. The page that activates the different frames will only contain the information on the size of the frames and there names. It will not contain any HTML coding beyond that, except the title, unless you make an alternate page for the people who have a browser that does not support frames (I highly recommend that). After you have inserted the title of the document you would then start on the frames.
To start a set of frames you need to enter the frame command. This command is an angle bracket “<“ followed by the word FRAMESET followed by the height (either height of columns or height of rows) of the frames followed by an angle bracket “>”. Before you enter the size of the frames you first need to decide how many you want to have. For obvious reasons we will use an example that only has two. First we will enter the height of the columns. The height of either frames can be specified in either percent, size of pixels, or an asterisk “*”. The percent will be how much of the page the column or row of that frame will use, the size in pixels will be the amount of pixels that frame will use, and the asterisk “*” will tell the browser that you want the frame to use all of the space left on the page. (Since we are going to use an example from my page we are going to use pixels and asterisks “*”, but let me tell you how to use percent as well. The only difference between entering a percent and entering a number of pixels is that for percent you would enter a number 1 through 100 followed by a percent sign “%”.) Since I have two frames I will have to put in two values for the frame columns. I would like my first frame to take up all the the columns that are not used by the other frame so I will enter the modifier COLS then an equal sign “=” then an asterisk “*” then a comma “,” then a zero “0” (because I want the second frame to have no column space).
NOTE: If you have two frames and you enter a value before an asterisk “*” it will make the frame that much larger then the other one. For example, if you entered a 2 in front of one asterisk and nothing in front of the second asterisk (your source would look like this: 2*,*) the first frame would be twice as large as the second one.
Then I would enter FRAMESET again with another modifier that signals the height of the rows. This modifier is the word ROW then an equal sign “=” then the values for each frame separated by commas. In this example our first frame is going to take up all the space that the other frame does not take up so its size will be an asterisk “*” and the other frame is going to use 70 pixels of the page. The starting source code for this frame would look like this:
<FRAMESET COLS=*,0>
<FRAMESET ROWS=*,70>
Next I must tell the browser what documents I want in my two frames and some information about the frame. Since I have two frames I will have to enter this information twice. The command to tell the browser what document I want in the first frame is an angle bracket “<“ followed the word FRAME followed by the letter SRC followed by an equal sign “=” followed by the name of the HTML document that is too appear in the frame followed by the modifiers followed by an angle bracket “>”. Our first frame is going to have a name test2.html so I will enter that into the code. There are five different modifiers that can be used to change your frame. The first modifier is NAME this modifier tells the browser what the name of the frame is and is only needed if you are going to have links in other frames go into that frame. We will name this frame Main. The next two modifiers deal with the width and height of the margins of the documents that are going to be shown in the frame. You might not have noticed this but normal HTML documents have a rather large margin and if your frame is going to be small you would want to get rid of that. The command is either a MARGINWIDTH or MARGINHEIGHT then an equal sign then a pixel value. Our first frame is not going to use these modifiers. The next modifier is the modifier that allows the frame to scroll, if you do not enter this the browser will automatically choose if the frame is going to have scroll bars. The commands that can be entered after the main modifier which is SCROLLING then a equal sign “=” then either the words yes, no, or auto. Since auto is the default, our first frame is not going to use this command. The final modifier is noresize, this is if you do not want the user to be able to resize the frame by dragging it. I do not care if the user resizes the frame so I will not use this modifier. Our next frame is going to contain a document called frame.html, this frame is going to have a marginheight of 1 pixel, no scrolling, and is not going to be able to be resized. To end of the frame command you enter the ending modifier which is an angle bracket “<“ followed by a slash “/” followed by the word FRAMESET followed by an angle bracket “>”. The final source code for this document would look like this:
Earlier I had mentioned that you could specify a frameless page for the people who’s web browser does not support frames. In order to do this, you must enter the starting command which is an angle bracket “<“ followed by the word NOFRAMES followed by an angle bracket “>”. Then you would enter your HTML code that you want the person to see then you would enter the command to finish the HTML code. This command is an angle bracket “<“ followed by a slash “/” followed by the word NOFRAMES followed by an angle bracket “>”. The final source code would look like this: