Ken Ward's HTML Tutorial ...

The difference between _top and _parent


Normally there isn't any observable difference between top and parent, because normally the top is the window, and the parent document is there. Where there are frames within frames, however, the parent is the immediate parent, and this may in turn have parents. So if this page were a frames page, its component pages would have this page as the parent, and this page, as you can see has a parent which is the frame! (I don't know if you can understand all this, but I can't! Sounds like the song, "Dem bones...!" However, you will understand the next paragraph!)

Image that your little frames page is floating on the internet. And some big frame links to your page, putting it in its frame. Now we have a big bad frame page holding your poor frame page inside it. So we have frames within frames. The big bad page is in the top and your frame page is being eaten up by it. The pages within your frame page have their proper parent, but the parent is inside the big bad frame page! If the click the following link and choose the 'Get out of frames' link, you will load the frame in the top of the window. Press the back button of your browser to return here.

Grab a frame!

If you clicked on the above link and chose to get out of this frame, then you will have seen how the hyperlink worked. Here is the code:

<a href="framesCaught.htm" target="_top">Get out of Frames!</a>

Yes, quite simple! The 'Get out of frames' link loads the frames page again, this time with the " target="_top". So you can use an HTML technique to get out of frames. But if you want to look at how it is done, perhaps more gainfully with Java Script, click the preceding link.

[back to: Targets in Frames]

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

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