|
To access the contents, click the chapter and section titles.
Platinum Edition Using HTML 4, XML, and Java 1.2
splits the window into four columns (see Figure 7.4). The first column is 135 pixels wide; the second is 75 pixels wide; and the remaining space is divided between the third and fourth columns, with the third column four times as wide (4*) as the fourth (*).
The <FRAMESET> tag can also take two script-related attributes: onload and onunload. These event handlers execute the script code you assign to them when the framed layout is loaded and unloaded, respectively.
Nesting <FRAMESET> Tags to Achieve Complex LayoutsTo produce really interesting layouts, you can nest <FRAMESET> and </FRAMESET> tags. Suppose you want to split the browser window into eight equal regions. You can first split the screen into four equal rows with the following HTML: <FRAMESET ROWS=25%,25%,25%,25%> ... </FRAMESET> This produces the screen shown in Figure 7.5. Next, you need to divide each row in half. To do this, you need a <FRAMESET> tag for each row that splits the row into two equal columns. The HTML <FRAMESET COLS=50%,50%> ... </FRAMESET> does the trick. Nesting these tags in the HTML at the beginning of this section produces the following: <FRAMESET ROWS=25%,25%,25%,25%> <FRAMESET COLS=50%,50%> <!-- Split Row 1 into two columns --> ... </FRAMESET> <FRAMESET COLS=50%,50%> <!-- Split Row 2 into two columns --> ... </FRAMESET> <FRAMESET COLS=50%,50%> <!-- Split Row 2 into two columns --> ...
</FRAMESET> <FRAMESET COLS=50%,50%> <!-- Split Row 4 into two columns --> ... </FRAMESET> </FRAMESET> The HTML above completes the task of splitting the window into eight equal regions. The resulting screen is shown in Figure 7.6.
Of course, youre not limited to making regions that are all the same size. Suppose you want an 108-pixel-wide table of contents frame to appear down the left side of the browser window, and on the right side, you need a 92-pixel row for a logo; the balance of the right side is for changing content. In this case, you could use the HTML <FRAMESET COLS=108,*> <!-- Split screen into two columns. --> ... <!-- Placeholder for table of contents. --> <FRAMESET ROWS=92,*> <!-- Split column 2 into two rows. --> ... <!-- Placeholder for logo. --> ... <!-- Placeholder for changing content frame. --> </FRAMESET> </FRAMESET>
The ellipses you see in the preceding code are placeholders for the tags that place the content into the frames that the <FRAMESET> tags create. You put a document in each using the <FRAME> tag discussed in the next section. Placing Content in Frames with the <FRAME> TagUsing <FRAMESET> tags is only the beginning of creating a framed page. After the browser window is split into regions, you need to fill each region with content. The keys to doing this are the <FRAME> tag and its many attributes. With your frames all set up, youre ready to place content in each frame with the <FRAME> tag. The most important attribute of the <FRAME> tag is SRC, which tells the browser the URL of the document you want to load into the frame. The <FRAME> tag can also take the attributes summarized in Table 7.1. If you use the NAME attribute, the name you give the frame must begin with an alphanumeric character.
|
Products | Contact Us | About Us | Privacy | Ad Info | Home
Use of this site is subject to certain Terms & Conditions, Copyright © 1996-2000 EarthWeb Inc. All rights reserved. Reproduction whole or in part in any form or medium without express written permission of EarthWeb is prohibited. Read EarthWeb's privacy statement. |