框架可以实现在同一浏览器窗口,浏览不同的页面。一个页面的超链接一般跳转到一个新的浏览器窗口,而导航框架可以通过超链接在同一窗口显示不同的页面。接下来展示一下导航链接的实现。
1.主页面,将页面分为两栏,其中index.html包括三个超链接,即导航框架包含一个将第二个框架作为目标的链接列表。
<html>
<frameset cols="120,*">
<frame src="index.html">
<frame src="contend.html" name="content" >
</frameset>
</html>
2.index.html
<!DOCTYPE html>
<html>
<head>
<title>a</title>
</head>
<body>
<a href="a.html" target="content">frame_a</a>
<a href="b.html" target="content">frame_b</a>
<a href="c.html" target="content">frame_c</a>
</body>
</html>
其中元素<a>中的target属性至关重要,他决定将在content中分别显示超链接a,b,c的内容。