|
![]() |
|
| | Home | Table of Contents | Next Page | Previous Page | |
|
|
Using Frames |
|
| Everything has it's place. When frames first came on the
scene, every "hip" site on the 'net had to have some. It was like
a Hula Hoop or a Pet Rock. Things settled down quickly under heated criticism.
I think the novelty has worn off and this element is starting to serve a
useful purpose.
The fact that neither Netscape (the original inventor of the idea?) or Microsoft have frames on their home pages should be a clue to the rest of the world. Not that I'm recommending them as the standards. Or should I? After all, between the two of them that's most the browsers in use! In spite of all the opposition and strong emotions surrounding this feature, I like it in certain instances. In the last chapter I spent a lot of time showing how tables work and I'm implementing some page formatting for this Guide using tables. But, sometimes frames are the only way to achieve the look or effect you want. Frame BasicsThe <frameset>, <frame> and <noframes> tags are used to define a frames setup. It's important to note - these tags REPLACE the <body> elements in a document. A frame set is made up of several HTML pages. The first page defines the display areas and the pages that are initially displayed in them. The subsequent pages don't show any blatant signs that they are part of a frame. In fact, they work equally as well when you load them manually. You may notice one subtle difference - in the <a href... > element you might see a target attribute. This is used to define the frame where the href file is displayed. Why would you use frames? Back when I did it, I wanted a vertical menu to appear at the left and have it remain fixed and in view during the visit. I wanted the viewer to be able to scroll my documents up and down but always have the navigation tools at their fingertips. But I abhor the scrollbars that intrude in the middle of the screen. I was very careful to make sure my navigation aids fit within a small area to minimize the chance that a scroll bar would be generated. The frame code I used to define my home page was:
The general structure involves defining the areas on the screen. The first frameset line defines the horizontal size of the area. I want to use the whole area so I used rows="*" to define it. Within this first area I wanted to define two additional divisions. The second frameset line does that by specifying cols="135,*". This has the effect of creating a left hand column 135 pixels wide and a right hand column that fills the rest of the display area. The first frame statement then gives the left column a name and tells the browser what page I want displayed there at start up. I also give the browser permission to put in scrolling bars if the area is too small to display my page without them. The second frame statement does the same thing. After these definitions, I end the frameset definition and launch into the noframes specification. Within the noframe definition I finally have the body element and some normal HTML code. Basically, I'm telling the viewer that I'm an elitist pig and they should run out and equip themselves with the latest technology if they want to enjoy my work! Oh well, can't be perfect now can we? So what happens when this page is loaded? If the browser is "frame enabled" it sets up the frames according to your specifications and completely ignores all the gibberish betweent the noframes tags. The beauty of standards, when they are followed, is that they tell browser makers what to do when they don't understand something. In the case of HTML elements, browser writers are supposed to simply ignore elements they don't deal with. If you'll look closely at the code above you'll notice that all the information is contained as attributes of the elements. If my page is brought into a browser that doesn't do frames then it's supposed to ignore all the lines with frame, frameset and noframes. If you cross out those lines in the example guess what's left - just my rude comments contained in a normal bit of HTML. Pretty tricky, huh? Frame MannersIf your ever disposed to do frames I would suggest a few things for you to keep in mind:
One other note of caution - I learned this the hard way - the programs that scan your site automatically for the search engines don't seem to like frames very much. They seem to come in at the top and then when they find no links the scan stops. They don't seem to interpret the frame arguments about which pages to load so your site pretty much gets ignored. For a while I put in some links in my noframes section but that didn't seem to help much. That's one of the main reasons I took the frames off my top level pages. Just keep that in mind as you develop your site. All this talk has made me little thirsty! Let's go get some Java!! |
| | Home | Table of Contents | Next Page | Previous Page | |
|
Michael T. Rusk All contents copyright © 1996-2001 Michael
T. Rusk Revised:
Sunday, December 30, 2007 11:05
-05:00 |