How
to set attributes for frames
There are several attributes
you can add to the individual
tags of the index/main page:
Attributes: |
Explanation: |
scrolling=yes/no/auto |
Controls whether frameset contains
scrollbars or not. |
noresize |
Adding this attribute will cause that
particular frameset to not be resizable. |
border=pixels |
Sets the border size of each frameset |
frameborder=no
border=no framespacing=no |
This is a combination of tags for borderless
frames in both NS and IE. |
These attributes are inserted into the
first example this way:
Lets say we want a left bordered frame
with no borders showing:
<html>
<head>
<title>First
example</title>
</head>
<frameset cols="20%,80%"
frameborder=no
border=no framespacing=no>
<frame src="file1.htm">
<frame src="file2.htm">
</frameset>
</html>
This will create a two columned frame with
no borders showing.
You can also insert attributes in the individual
frame,
which will add attributes to only that
particular frame.
In the second example if we want to have
scroll bars only in the second frame,
the code will be changed this way:
<html>
<frameset rows="20%,80%">
<frame src="file1.htm"
scrolling=no>
<frame src="file2.htm"
scrolling=yes>
</frameset>
</html>
How
to create links to another frame or window
When you have a link in one frame, the
content that's loaded will be loaded in the same frame.
|It is possible to load the linked file
in the same window, but in another frame. It is possible this
second frame to fill the whole window.
It is possible the second loaded file to be opened in the
new window. Now lets see how will be changed
one of the above examples when we insert
names of the every frame.
<html>
<head>
<title>index-file</title>
</head>
<frameset
rows="12%,*">
<frame name="frame1"
src="file1.htm">
<frameset cols="20%,*">
<frame name="frame2"
src="file2.htm">
<frame name="frame3"
src="file3.htm"
</frameset>
</frameset>
</html>
-
If there is a link in
the file2.htm you can show the loaded second file in the frame3 this way:
file2.htm:
<html>
<body>
<a href="loaded_file.htm"
target="frame3">text_link</a>
</body>
</html>
We added "target=" attribute to the "<a
href=>" tag and referring to that second frame's name.
-
The loaded second file will be shown
into a full page:
file2.htm:
<html>
<body>
<a href="loaded_file.htm"
target="_top">text_link</a>
</body>
</html>
-
The loaded file will be shown in the new window
after2 clicking on the button
if we use this simple JavaScript:
file2.htm:
<html>
<body>
<form>
<input type="button"
value="Click here" onclick="window.open('loaded_file.htm')">
</form>
</body>
</html>
|