|
To access the contents, click the chapter and section titles.
Platinum Edition Using HTML 4, XML, and Java 1.2
To place content in each of the regions you created at the end of the previous section, you can use the following HTML: <FRAMESET COLS=108,*> <!-- Split screen into two columns. --> <FRAME SRC=toc.html> <!-- Placeholder for table of contents. --> <FRAMESET ROWS=92,*> <!-- Split column 2 into two rows. --> <FRAME SRC=logo.html> <!-- Placeholder for logo. --> <FRAME SRC=content.html> <!-- Placeholder for changing content --> </FRAMESET> </FRAMESET> The resulting screen appears in Figure 7.7. Certainly, the SRC attribute in a <FRAME> tag is essential. Otherwise the browser would not know where to look for the content that is to go into the frame.
Youll probably find that you frequently use the other attributes as well. In particular, MARGINWIDTH and MARGINHEIGHT enable you to set up left and right (MARGINWIDTH) and top and bottom (MARGINHEIGHT) margins within each frame. Putting a little whitespace around the content in each frame enhances readability, especially when you have FRAMEBORDER set to zero. The NORESIZE and SCROLLING attributes are handy when you want to modify the user-controlled aspects of a frame. Recall that a user can change the size of a frame by clicking a border of a frame and dragging it to a new position. NORESIZE is a Boolean attribute that, when present in a <FRAME> tag, suppresses the users ability to change the size of the frame. You might want to do this if it is imperative that the size of a frame not change so that it can always accommodate a key piece of content. SCROLLING can be set to YES if you always want horizontal and vertical scrollbars on the frame, and to NO if you never want scrollbars. The default value of SCROLLING is AUTO, in which the browser places scrollbars on the frame if theyre needed and leaves them off if theyre not needed.
Targeting Named FramesProbably the trickiest thing about frames is getting content to appear where you want it to appear. This is where naming the frames you create becomes critical. By naming the changing content frame main, you can then use the TARGET attribute in all your <A> tags to direct all hyperlinked documents to be loaded into that frame: <FRAMESET COLS=108,*> <!-- Split screen into two columns. --> <FRAME SRC=toc.html> <FRAMESET ROWS=92,*> <!-- Split column 2 into two rows. --> <FRAME SRC=logo.html> <FRAME SRC=content.html NAME=main> </FRAMESET> </FRAMESET> With frames set up by the preceding code, an example link in the file toc.html might look like this: <A HREF=orderform.html TARGET=main>Order Now!</A> The TARGET attribute tells the browser that the file orderform.html should be loaded into the frame named main (the changing content frame) whenever a user clicks the hypertext Order Now! in the table of contents frame. If all the links in toc.html target the frame named main, you can use the <BASE> tag in the head of the document to set a value for TARGET that applies to all links: <HEAD> <TITLE>Table of Contents</TITLE> <BASE TARGET=main> </HEAD> With this <BASE> tag in place, every hyperlink targets the changing content window named main. Netscape set aside some reserved frame names when it introduced the frame-related tags. These special target names include
|
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. |