Working with frames and links

By default, clicking a link in a frame opens the linked file inside the same frame. But if you have something like a links frame, you want the page to open in one of the other frames. This requires a couple of steps; give a name to each frame and then point each link to one of the named frames.

To assign a name to a frame:

<frame src=”url” name=”name” />

Case is important when assigning names!

To point the target of a link to a named frame:

target=”name”

Reserved target names are special names that can be used in place of a specific frame name.

Reserved Target Names

Reserved name

Function in a frameset
_blank Loads the target into a new browser window
_self Loads the target into the frame that has the link
_parent Loads the target into the parent of the frame
_top Load the document into the full display area and replaces the current frame layout

Noframes element

The noframes element allows your web site to be viewed with browsers that do not support frames. This marks a section of your code that browsers incapable of displaying frames can use. It is nested within your frameset element. It looks like this:

<html>
<head>
<title> Your title here </title>
<frameset>
frames
<noframes>
<body>
page content
</body>
</noframes>
</frameset>
</html>

Working with frame borders

Setting the frame border color

You can do this but be aware that different browsers handle this differently and make sure you always check your page in as many browsers as possible. The format is:

Bordercolor=”color”

Applying this to a frameset affects all the frames and nested frames. If you use it on a frame, the results differ depending upon the browser you use.

Setting the border width

The format is:

<frame frameborder=”value” />

where value is the size of the border in pixels.

Inline frames (floating frames)

An inline or floating frame is displayed as a separate box or window within a web page. To create one:

<iframe src=”url”>
alternate content
</iframe>

You should always have the alternate content in case the browser doesn't support frames. The alternate content is typically a link to where this page can be seen if it can't be viewed in a frame:

<iframe src=”url”>
<p>
View this listing at <a href=”url”> Listing </a>
</p>
</iframe>


Frame Attributes

Attribute Description
Frameborder=”value” Specifies whether to display a frame border (1) or not (0)
Height=”value”
width=”value”
The height and width of the frame in pixels
Marginheight=”value”
marginwidth=”value”
The size of the margins in pixels
Name=”name” The name of the frame
Scrolling=”type” Yes(can be scrolled) or no (cannot be scrolled)
Src=”url” The url of the document to be displayed
Style=”styles”

Styles applied to the inline frame

Return to main