Share this Page URL

Chapter 13. Fooling Around with Frames > Fancier Frames - Pg. 153

Fooling Around with Frames 153 Fancier Frames To finish this frames tutorial, let's kick things up a notch and look at a technique that enables you to create some pretty fancy frame effects. So far, you've learned only how to divide the browser window into horizontal regions or vertical regions. What do you do if you want to combine these types? For example, suppose you define an upper frame and a lower frame and you then want to divide the lower frame into two vertical sections? Well, it turns out that you can use as many <FRAMESET> tags as you like in a single frame page. So you can get your desired layout by defining one <FRAMESET> tag to divide the screen in two horizontally and then insert a second <FRAMESET> tag that divides the lower region vertically. Here's the code for an HTML page (frame6.htm on the CD) that does this: <HTML> <HEAD> <TITLE>Nested Frames</TITLE> </HEAD> <FRAMESET ROWS="25%,75%"> <FRAME SRC="1.htm" NAME="Upper"> <FRAMESET COLS="50%,50%"> <FRAME SRC="2.htm" NAME="Lower"> <FRAME SRC="3.htm" NAME="Right"> </FRAMESET> </FRAMESET> </HTML> This technique is called nesting frames, and you can use it to create whatever layout suits your needs. Figure 13.9 shows how the example looks in the browser. Figure 13.9. You can nest frames to achieve some interesting layouts. The Least You Need to Know · Frames: an out of <BODY> experience. In your frameset page, you use <FRAMESET> and </FRAME- SET> instead of <BODY> and </BODY>. · Horizontal or vertical frames. In the <FRAMESET> tag, use the ROWS attribute to divide the browser into horizontal frames, or use the COLS attribute to divide the browser into vertical frames. · Use <FRAME> to fill in the frames. Add the SRC attribute to each <FRAME> tag and set it equal to the address of the regular page that you want loaded into the frame. · The frame name game. If you want a link to display a page in a specific frame, first name all your frames by adding the NAME attribute to each <FRAME> tag. Then plop the TARGET attribute inside the <A HREF> tag and set it equal to the name of the frame in which you want the page to show up.