定义与用法
The frameset element defines a frameset. It is used to organize multiple windows (frames). Each frame holds a separate document. In its simplest use, the frameset element states only how many columns or rows there will be in the frameset. You must use the cols or the rows attribute.
frameset元素用来定义一个框架集。它的用处是将多个窗口(框架)集中在一起。每个框架其实都是一个相对独立的文档。框架集最简单的用途就是声明在它里面有多少个竖着或是横着的框架。要做到这些你必须使用col或是row属性。
它在HTML和XHTML中的区别
NONE
无
提示与注意点
Note: If you want to validate a page containing frames, be sure the DTD is set to "Frameset DTD". Read more about XHTML Validation.
注意:如果你要校验包含在框架内的页面,请确定你所设置的DTD为"FramesetDTD"。你可以阅读有关XHTML校验方面的信息。
Important: You cannot use the <body></body> tags together with the <frameset></frameset> tags! However, if you add a <noframes> tag containing some text for browsers that do not support frames, you will have to enclose the text in <body></body> tags!
重点:你不能在<frameset></frameset>标签里使用<body></body>标 签!但是,当你要给那些无法支持框架的浏览器提示一些文字信息的话必须在<noframes>标签内使用<body>这里写提示 的文字</body>标签
实例
代码 | 输出结果 |
<a href="planets.htm" target="_blank">查看此页的结果</a> "planets.htm"文件中的源代码如下: <html> <frameset cols = "25%, 25%,*"> <frame src ="venus.htm" /> <frame src ="sun.htm" /> <frame src ="mercur.htm" /> </frameset> </html> | 查看此页的结果 |
可选属性
DTD indicates in which DTD the attribute is allowed. S=Strict, T=Transitional, and F=Frameset.
下表中的DTD列指明了被支持的DTD属性。S=Strict(精确的),T=Transitional(传统的),F=Frameset(框架)
属性 | 值 | 描述 | DTD |
cols | pixels % * | Defines the number and size of columns in a frameset 定义框架集中的列数,以及它的大小 | F |
rows | pixels % * | Defines the number and size of rows in a frameset 定义框架集中的行数,以及它的大小 | F |
标准属性
Only allowed in XHTML 1.0 Frameset DTD!!
只有在XHTML1.0 Frameset DTD中才被允许!
For a full description, go to Standard Attributes.
查看完整的属性
事件属性
NONE
无
尝试与演示
Vertical frameset
How to make a vertical frameset with three different documents.
怎样建立一个含有三个不同文档的垂直框架集。
Horizontal frameset
How to make a horizontal frameset with three different documents.
怎样建立一个含有三个不同文档的水平框架集。
Mixed frameset
How to make a frameset with three documents, and how to mix them in rows and columns.
建立一个含有三个同文档的混合框架(水平与垂直混合)
How to use the <noframes> tag
This example demonstrates how to use the <noframes> tag.
如何使用<noframes>标签
Frameset with noresize="noresize"
How to use the "noresize" attribute. The frames are not resizable. Move the mouse over the borders between the frames and notice that you can not move the borders.
怎样使用"noresize"属性。用鼠标移动相邻两框架的边框会发现不会发生变化。
Navigation frame
How to make a navigation frame. The navigation frame contains a list of links with the second frame as the target. The file called "tryhtml_contents.htm" contains three links. The source code of the links:
如何建立框架导航。其中的一个框架包含连接,另一个框架则显示连接的目标文档。包含连接的文件名为"tryhtml_content.htm"其中包含三个连接,它的代码如下:
<a href ="frame_a.htm" target ="showframe">Frame a</a><br>
<a href ="frame_b.htm" target ="showframe">Frame b</a><br>
<a href ="frame_c.htm" target ="showframe">Frame c</a>
The second frame will show the linked document.
第二个框架会显示目标文档
Jump to a specified section within a frame
This example demonstrates two frames. One of the frames has a source to a specified section in a file. The specified section is made with <a name="C10"> in the "link.htm" file.
在这个举例中将会有两个框架。其中的一个可以用来指定某文件的某一个位置。指定的位置是文件"link.html"中的一个锚点:<a name="C10">
Jump to a specified section with frame navigation
This example demonstrates two frames. The navigation frame (content.htm) to the left contains a list of links with the second frame (link.htm) as a target. The second frame shows the linked document. One of the links in the navigation frame is linked to a specified section in the target file. The HTML code in the file "content.htm" looks like this: <a href ="link.htm" target ="showframe">Link without Anchor</a><br><a href ="link.htm#C10" target ="showframe">Link with Anchor</a>.
这个举例中有两个框架,其中的一个含有指向内容页某一位置的连接,点击连接后另一个框架会显示内容页并直接显示出那个指定的位置。