HTML 多窗口页面

来源:互联网 发布:mac app 文件夹 编辑:程序博客网 时间:2024/05/17 22:14
<frameset cols=70%,* bordercolor=blue>
    
<frameset rows=20%,80% bordercolor=red>
        
<frame name=A src="A.html" frameborder=0 framespace=10 noresize>
        
<frame name=B src="B.html" frameborder=0 noresize>
    
</frameset>
    
<frame name=C src="C.html" frameborder=0>
</frameset>
 
<center>
<iframe src="A.html" name="window">
   Here 
is a Floating Frame
</iframe>
<br><br>
<a href="A.html" target="window">Load A</A><BR>
<a href="B.html" target="window">Load B</A><BR>
<a href="C.html" target="window">Load C</A><BR>
</center>

将同一页面分割成若干窗口有利于管理同一页面不同内容的load,常用的是使用frameset来管理布局;

语法如下:基本语法

<frameset> ... </frameset>
<frame src="url">
<noframes> ... </noframes>

在 <noframes> 标记后的文字将只出现在不支持 FRAMES 的浏览器中。

        <HTML>        <HEAD>        </HEAD>        <FRAMESET>     ////////此frameset中只有一个frame             <FRAME SRC="A.html">             <NOFRAMES>此浏览器不支持 </NOFRAMES>        </FRAMESET>        </HTML>

各窗口的尺寸设置

<frameset cols=#>

纵向排列多个窗口:

<frameset cols=30%,20%,50%><frame src="A.html"><frame src="B.html"><frame src="C.html"></frameset>

A B C

 

<frameset rows=#>

横向排列多个窗口:

<frameset rows=25%,25%,50%><frame src="A.html"><frame src="B.html"><frame src="C.html"></frameset>

A B C

COLS & ROWS

纵横排列多个窗口:

<frameset cols=20%,*><frame src="A.html">     <frameset rows=40%,*>     <frame src="B.html">     <frame src="C.html">     </frameset></frameset>示例

A B C

 

不允许各窗口改变大小 <frame noresize>

缺省设置是允许各窗口改变大小的。
 

各窗口间相互操作(Frame Target)

窗口标识(Frame Name)
<frame name=#>
<a href=url target=#>

<frameset cols=50%,50%><frame src="A.html"><frame src="B.html" name="HELLO"></frameset>

A B

特殊的 4 类操作(很有用喔)

<a href=url target=_blank> 新窗口
<a href=url target=_self> 本窗口
<a href=url target=_parent> 父窗口
<a href=url target=_top> 整个浏览器窗口

Frame 的外观(Appearance)

各窗口边框的设置 <frame frameborder=#> #=yes, no / 1, 0

<frameset rows=30%,*><frame src="Acol.html" frameborder=1>//有边框<frameset cols=30%,*>     <frame src="Bcol.html" frameborder=0>///无边框     <frame src="Ccol.html" frameborder=0></frameset></frameset>

(A 有边框,B、C 没有)

A B C

各窗口间空白区域的设置
<frameset framespacing=#> #=空白区域的大小

<frameset rows=30%,* framespacing=100><frame src="Acol.html"><frameset cols=30%,*>     <frame src="Bcol.html">     <frame src="Ccol.html"></frameset></frameset>

A B C

边框色彩 <frameset bordercolor=#>

#=rrggbb 16 进制 RGB 数码, 或者是下列预定义色彩名称:
Black, Olive, Teal, Red, Blue, Maroon, Navy, Gray, Lime,
Fuchsia, White, Green, Purple, Silver, Yellow, Aqua
<frameset rows=30%,* bordercolor=red><frame src="Acol.html"><frameset cols=30%,*>     <frame src="Bcol.html">     <frame src="Ccol.html"></frameset></frameset>

A B C

页面空白(Margin) <frame marginwidth=# marginheight=#>

<frameset cols=50%,50%><frame src="A.html"><frame src="A.html"     marginwidth=50     marginheight=50></frameset>

AAAA AA
AA

卷滚条设置 <frame scrolling=#> #=yes, no, auto

#=缺省值是 auto。
 

浮动窗口(Floating Frame)

<iframe src=# name=##> ... </iframe>
#=初始页面的 URL
##=窗口标识(Frame Name)(之后可对此标识进行各窗口间相互操作)
... = 此处文字将只出现在不支持 FRAMES 的浏览器中。

<center><iframe src="A.html" name="window">   Here is a Floating Frame</iframe><br><br><a href="A.html" target="window">Load A</A><BR><a href="B.html" target="window">Load B</A><BR><a href="Ccol.html" target="window">Load C</A><BR></center>

示例:

B.HTML

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-31j">
<title>Insert title here</title>
</head>
<body>
second
<center>
<iframe src="A.html" name="window">
   Here is a Floating Frame
</iframe>
<br><br>
<a href="A.html" target="window">Load A</A><BR>
<a href="B.html" target="window">Load B</A><BR>
<a href="C.html" target="window">Load C</A><BR>
</center>
</body>

A.HTML

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-31j">
<title>Insert title here</title>
</head>
<body bgcolor=red>
<a href="B.html">first</a>
</body>
</html>

INDEX.HTML

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<frameset cols=70%,* bordercolor=blue>
 <frameset rows=20%,80% bordercolor=red>
  <frame name=A src="A.html" frameborder=0 framespace=10 noresize>
  <frame name=B src="B.html" frameborder=0 noresize>
 </frameset>
 <frame name=C src="C.html" frameborder=0>
</frameset>
</head>
<body>

</body>

</html>

/////此处框架不是写在body中.

原创粉丝点击