Tutorial #12:
|
Frames are a powerful addition to a web site. They can display separate pages where you want them, rather than one big confusing page that has everything.To see frames in action, click here. Are you back yet? OK. Did you see how he had 'Welcome' in one frame, the links in another, and other stuff like the credits? That is what you can do with frames. When using frames, you have to remember the fact that not all web browsers support frames. When setting up frames, you must remember to not put in the <body> tag. Instead, you put the <frameset> tag. Here's an example of a bare bones frame page (Click on code to see the example): Now, you need to call in the files that go into a frame by using the frame src tag. And of course, once you are done with that, type in </frameset> and you're all set. Well, not really...
More Complicated StuffWhat if you wanted a page that had both rows and columns? "How do you do that?" you might ask. Well look at the code to do this.
<head> <title>A Little Framework</title> </head> <frameset cols="80%,20%"> <frame src="framestutorial.html">
<frameset rows="50%,50%">
</frameset> If you want to make a good frameset complete, it gets even more complicated. Take a look...
<head> <title>A Little Framework</title> </head> <frameset cols="80%,20%" cellspacing=0 cellpadding=0 border=0> <frame src="framestutorial.html" name="main" scrolling="auto">
<frameset rows="50%,50%">
<noframe>
</frameset>
Almost Done!I want to talk about one more thing: linking. Do you remember how I had the frames named? This is where they come into play. Here's the script:<a href="next.html" target="main">Learn it!</a> The target is the part that makes this work. Well, that was easy. Here's the last thing that I am including. What if you want to open up a new set of frames when you click on a link or get rid of the frames altogether? Then put target="_top". I don't know why there is the underscore and all, but that's what you have to do. You'll want to do the forms tutorial now. |