Ken Ward's HTML Tutorial ...

Targeting files in frames!

The TARGET

If you have a hyperlink in a page within a frames page, the hyperlink knows which file you want to load, if you follow the earlier procedure, but how does it know which frame to put the file?

You can do this by using the target tag in the anchor.

(Here we are talking about HTML ... you may wish to check out how to use hyperlinks with javascript.)

For example, the following frame page has a frame called TopRightFrame. The following code will load the frameTestPage.htm file into the frame TopRightFrame;

<A HREF="frameTestPage.htm" TARGET="TopRightFrame">Load the file in the top right frame.</A>

Demonstrating Targets in Frames.

See how this works by playing with the following, but remember to use the browser's back button to get back here, and to return to the start when testing! frame page.

The targets with an underscore are special ones. You can check to see what they do in your browser.

Here is what they are supposed to do;

Special Target Tags
Tag Effect
No tag specified. Loads file in same frame.
_self Loads file in the frame calling it, as for no tag!
_blank Loads file in new browser window. Useful to let your visitor break out of your frames, but keep a window open with their site.
_top Loads the file in the same browser window, but breaks out of frames.
_parent Loads the file in the frame that contains the calling frame, or if this is the parent frame, then it loads in the same browser window outside of frames, in Internet Explorer.

Exactly how these work does depend on the browser used.

The difference between _top and _parent

Base Target

You can put <base target="The frame you want to load the files.htm"> in the <head></head> tags of the document to load all hyperlinks without a target into the default frame. See an example with code However, what about those poor people with browser's that can't read frames? We have to take them into account because they include search engine spiders!

Let's look at noframes!


[back to: columns in frames]
[home][contents]
[on to:  no frames]


Most Recent Revision: 18-Oct-98.
Copyright © 1998

I am always pleased to hear from you.
Send your comments to