Specifying the Frame in Which a Linked Page Opens


If you code your frame definition pages as shown up to this point in the chapter, a link that appears in any of the pages opens its corresponding file in the same frame that holds the link. In other words, if I click a link that's shown in the upper-left frame, the page opened by that link also appears in the upper-left frame, replacing the file that was there.

If you want a link in one frame to open a new page in another frame, you must do two things:

  • In the <FRAME SRC> lines of the frameset, give each frame a name .

  • In the links within the content files, indicate the name of the frame in which the linked file should open.

Naming the Frames

Using the page created in the preceding example as a starting point, name the frames. Add the NAME= attribute to the <FRAME SRC> tag after the filename (and a blank space), as shown in the following code:

 <FRAMESET ROWS="75%,*") <FRAMESET COLS"30%,*") <FRAME SRC="MULTI.HTM" NAME="Icons"> <FRAME SRC="DESCRIP.HTM" NAME="Text"> </FRAMESET> <FRAME SRC="DEFINI.HTM" NAME="Definitions"> </FRAMESET> 

It doesn't matter what you call the frames, as long as you give each one a unique name. The frame names are not displayed on the page, just in the source code.

graphics/lightbulb_icon.gif

To name frames while creating them in the Frames Setup dialog box in HTML Assistant Pro, click the Advanced check box. Doing so expands the dialog box to reveal a box in which you can type a name for each frame.

Making Links Point to Frame Names

After naming the frames, you must edit the links within the content files to add the target : the name of the frame in which the linked files should open.

To code your targets in HTML, you must add the TARGET= attribute and the frame name (in quotes) to the link, following the filename, as in the following example:

 <A HREF="avidef.htm" TARGET="Definitions"></a> 

When the link shown is executed, the file AVIDEF.HTM opens in the frame named Definitions (the bottom frame), replacing DEFINI.HTM .

Suppose that you want every link in the MULTI.HTM file to open its file in the Text frame. When all links are to open in the same frame, you can save time by using the <BASE TARGET> tag in the content file's header. All links in a file containing a <BASE TARGET> tag open their files in the frame named by <BASE TARGET> ; you do not need to add any TARGET attributes to the link tags, as in the following example:

 <HTML> <HEAD> <TITLE> <BASE TARGET="Text"> </HEAD> <BODY> page definition goes here </BODY> </HTML> 

All links in the sample content file open their files in the Text frame.



Sams Teach Yourself Internet and Web Basics All in One
Sams Teach Yourself Internet and Web Basics All in One
ISBN: 0672325330
EAN: 2147483647
Year: 2003
Pages: 350
Authors: Ned Snell

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net