主框架页面代码:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link href="/News/include/style.css" rel="stylesheet" type="text/css">
<title>后台管理</title>
</head><frameset rows="*" cols="143,*" frameborder="no" border="0" framespacing="0">
  <frame src="/left.html" name="leftFrame" scrolling="No" noresize="noresize" id="leftFrame" title="leftFrame" />
    <frame src="/main.html" name="mainFrame" id="mainFrame" title="mainFrame" />
</frameset>
<noframes><body>
</body>
</noframes></html>
这里是一个左右型的框架,注意左边的为left.html,点击left中的任意一个链接将会在右边的框架中显示页面,其中右边的框架页面name为mainFrame
left.html代码如下:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>无标题文档</title>
<link href="/News/include/style.css" rel="stylesheet" type="text/css">
</head>
<body>
<p><a href="/News/user.html?method=userManage" target="mainFrame">用户管理</a></p>
<p><a href="/News/page.html?method=pageManage" target="mainFrame">风格管理</a></p>
<p><a href="/News/news.html?method=add" target="mainFrame">添加新闻</a></p>
<p><a href="/News/sub.html?method=list" target="mainFrame">订阅管理</a></p>
<p><a href="/News/collect.html?method=list" target="mainFrame">收藏管理</a></p>
<p><a href="/News/news.html" target="_blank">打开首页</a></p>
<p><a href="/News/user.html?method=logout" target="_parent">退出</a></p>
</body>
</html>
注意这里的每一个链接指定一个target属性为mainFrame,也就是右边框架的name