lecture 10: links in frames
Making links work in frames is pretty straightforward. It uses pretty much the same technique as for working with multiple windows. The key principles are, first, that via the <frame> tag, you give each frame a name. Have a look at your handout - and see how each of the three frames of the example have been given a name ("top", "left", "right").
Now, when you want to load a file into a particular frame, you once again include the target attribute. Only now, instead of referring to a named (or new) window, you refer to a named frame. For example, one of the links from the example looks like this:
<a href="ext_class1.html" target="right">Class one</a>
The link therefore causes the new file to open in that part of the window assigned the name, "right". (Note that if you omit the target the new file will simply open in the same frame as the link.)
There is a special target attribute of which you must be aware. This is target="_top". This "wipes" the window clean, removing all frames, and ensures that the new file is the only one visible in that window. On any site which uses frames, this must be used on all external links. If it's not, you "trap" the external site (and the user) within your frameset. This is very, very bad form, first because it is massively inconvenient, and second, you could even seem to be claiming authorship of this new site and thereby breaching copyright.
For an example, follow the instructions on the handout. (Sorry this is a fairly tortuous process: but that is what happens when looking through what is a really badly-designed site.)
|