Targeting Links to Frames - HTML

To change a frame’s content, you must be able to target a frame. To do so, you must use the name attribute to uniquely identify your frames. You can then use those names in scripts and anchor tags to direct new content to the frame.
Drag border to new position

Dragging the curser resizes the frames accordingly.

Dragging the curser resizes the frames accordingly.

Scripting languages can use the document’s frame collection to target a frame. For example, JavaScript can reference the content of a frame named news by changing the value of the following property:

parent.news.location.href

You can use similar methods and properties to otherwise manipulate the frame content and properties.

Cross-Reference
When you use the frameset DTD, the anchor tag (<a>) supports the target attribute, which can be used to target a frame for content. The target attribute supports the various values.

Note: To understand the difference between the _parent and _top values of the target attribute, you need to understand nested frames. Nested frames are covered in the next section. The easiest way to direct content to a frame is to use the frame’s name in the target attribute of an anchor.

This technique is often used to control one frame independently from another, especially where one frame has a navigation control and the other displays variable content. For example, the following code provides a handful of navigation links in the left (nav) frame, and the content is displayed in the right (content) frame. what this code looks like in a browser.

(Only home.html is shown in the following code—other content pages would look similar.)

Dragging the curser resizes the frames accordingly.

A simple frame-based navigation scheme. When the user clicks a link in the left frame, the content changes in the right frame. frameset.html

A simple frame-based navigation scheme

navigation.html


All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd DMCA.com Protection Status

HTML Topics