今天要记录的学习内容是关于在网页上面如何实现多窗口显示。采取的记录方式是先实现功能之后再解释语句的功能。
1.在网页上面实现垂直和水平交错的窗口
- frame.html
<html>
<head>
<title>C Languagelearning</title>
</head>
<!Set four frame>
<frameset rows="15%, *,15%">
<!Fist row>
<framesrc="frame_a.html" noresize scrolling="no"/>
<!Second row>
<!One this fram is cols>
<frameset cols="5%,*">
<framesrc="frame_b.html" noresize scrolling="no">
<frame src="frame_c.html"noresize scrolling="no">
</frameset>
<!Last row>
<framesrc="frame_d.html" noresize scrolling="no">
</frameset>
</html>
其中frame_a.html、frame_b.html、frame_c.html、frame_d.html的内容都是非常简单的代码如下
- frame_a.html
<html>
<head>
<title>head</title>
</head>
<!Set background colour>
<body bgcolor="3155A1">
<!Load a picture>
<img src="graphic/head.bmp">
</body>
</html>
- frame_b.html
<html>
<head>
<title>one</title>
</head>
<body bgcolor="4000D3">
<p>frame_b</p>
</body>
</html>
- frame_c.html
<html>
<head>
<title>TWO</title>
</head>
<body bgcolor="#FFFFFF">
<p>frame_c</p>
</body>
</html>
- frame_d.html
<html>
<head>
<title>Last frame</title>
</head>
<body bgcolor="3155A1">
<p>frame_d</p>
</body>
</html>
<html>
<head>
<title>Last frame</title>
</head>
<body bgcolor="3155A1">
<p>frame_d</p>
</body>
</html>
由链接到frame.html主页就可以看见一下的结果
2.语句解释
<frameset>.....</frameset>语句的作用是使当前网页上面出现多窗口,如上图的frame_b, frame_c, frame_d。
那么究竟是怎么得到上图中各版块的排版的呢?是这样的来的:
<frameset rows="15%, *, 15%">
这个语句告诉当前网页在水平方向上面将由三行,第一行占据15%的空间,第三行占据15%的空间,第二行占据剩余的空间。
<frame src="frame_a.html" noresize scrolling="no"/>
文档frame_a.html占据了第一行空间。
-
·<frameset cols="5%, *">
-
<frame src="frame_b.html" noresize scrolling="no">
-
<frame src="frame_c.html" noresize scrolling="no">
-
</frameset>
此语句段告诉当前网页要对第二行插入的内容再次进行多窗口的排版,把第二行的空间分为两列。其中已存在的文档frame_b.html占据空间5%,frame_c.html占据剩余的位置
-
<framesrc="frame_d.html" noresize scrolling="no">
文档frame_c.html占据了第三行空间。
就这样,当前网页的窗口就被这些语句实现了。
3.总结
- 您不能与 <frameset></frameset> 标签一起使用 <body></body> 标签。不过,如果您需要为不支持框架的浏览器添加一个 <noframes> 标签,请务必将此标签放置在 <body></body> 标签中!
- <frame> 标签定义 frameset 中的“一个"特定的窗口(框架)。
frameset 中的每个框架都可以设置不同的属性,比如 border、scrolling、noresize 等等
- 在linux下,使用vim编辑器编写html写的文本文档,html不识别绝对路径,如将<frame src="frame_a.html" noresize scrolling="no"/>改为<frame src="home/www/practice/frame_a.html" noresize scrolling="no"/>
网页将会显示,找不到相关文档的错误。
- 关于frameset中的属性设置,如border、scrolling、noresize等如若对其不熟悉可以在使用的时候对其查询。