|
Frames |
|
With Netscape Navigator 2.0, Netscape introduced a whole new model for HTML documents. This is the FRAME document, which lets you specify the display as having of a number of independent viewing frames, each of which can contain its own HTML document. |
| A multi-frame document does not contain a BODY element -- instead it contains a FRAMESET element, which defines the sizes, locations and initial contents of the individual FRAMES. |
|
| Creating a basic frame document |
| <html> |
| <head> |
| <title>This page contains two frames</title> |
| <frameset rows="50%,50%"> |
| <frame src="page1.htm" name="top"> |
| <frame src="page2.htm" name="bottom"> |
| </frameset> |
| </html> |
|
| View the page |
|
| The ROWS attribute can be replaced by COLS -- this will divide your frames vertically instead of horizontally.
|
| <html> |
| <head> |
| <title>This page contains two frames</title> |
| <frameset cols="50%,50%"> |
| <frame src="page1.htm" name="left"> |
| <frame src="page2.htm" name="right"> |
| </frameset> |
| </html> |
|
| View the page |
|
| Elements of the Frame tag |
| NAME, SCROLLING, and NORESIZE are three important attributes of <frame>. |
| Applying a name to the frame, provides its use as a target, but may be omitted if the frame is not to be targeted. |
| The value of SCROLLING can be YES, NO or AUTO. Setting SCROLLING to AUTO lets the browser decide if scroll bars are required which may provide increased frame area for data. |
| You may also restrict browsers from changing frame size by adding NORESIZE. |
| Here is an example: |
| <html> |
| <head> |
| <title>This page contains three frames</title> |
| <frameset rows="60,*,60"> |
| <frame src="pagea.htm" name="top" scrolling="no"
noresize> |
| <frame src="pageb.htm" name="content" scrolling="yes"
noresize> |
| <frame src="pagec.htm" name="buttom" scrolling="no"
noresize> |
| </frameset> |
| </html> |
|
| View the page |
|
| The noframe tag |
| If you load a frame document into a Web browser that does not support frames, you will get a blank page. Te get around this problem, the <noframe> tag was implemented. It enables you to include body text as part of the document. |
| <html> |
| <head> |
| <title>This page contains two frames</title> |
| <frameset cols="50%,50%"> |
| <noframe> |
| Include any text, hyperlinks or tags |
| </noframe> |
| <frame src="page1.htm" name="left"> |
| <frame src="page2.htm" name="right"> |
| </frameset> |
| </html> |
|
|