index.html代码如下:
<html>
<head>
<title>框架</title>
<Script type="text/javascript">
var currTitle=0;
</Script>
</head>
<frameset rows="65%,35%">
<frameset cols="12%,88%">
<frame name="tree" src="tree.html">
</frame>
<frame name="entryForms" src="home.html">
</frame>
</frameset>
<frame name="instructions" src="help.html"></frame>
</frameset>
</html>
tree.html代码如下:(这里需要用到1个图片)
<html>
<head>
<Script type="text/javascript">
function goHome()
{
parent.entryForms.location.href="home.html";
}
function goNext()
{
if(parent.currTitle<5)
{
parent.currTitle+=1;
parent.entryForms.location.href="dh"+parent.currTitle+".html";
parent.instructions.location.hash="help"+parent.currTitle;
}
else
{
alert("这是最后一个页面");
}
}
function goPrev()
{
if(parent.currTitle>1)
{
parent.currTitle-=1;
parent.entryForms.location.href="dh"+parent.currTitle+".html";
parent.instructions.location.hash="help"+parent.currTitle;
}
else
{
alert("这是第一个页面");
}
}
</Script>
</head>
<body>
<map name="navigation">
<area shapw="rect" coords="25,25,68,66" href="javascript:goHome()"/>
<area shape="rect" coords="25,80,67,116" href="javascript:goNext()"/>
<area shape="rect" coords="25,125,67,161" href="javascript:goPrev()"/>
<area shape="rect" coords="27,170,67,213" href="javascript:parent.window.close()"/>
</map>
<img src="dhNav.gif" height="240" width="96" border="0" usemap="#navigation"/>
</body>
</html>
dh1.html-dh5.html是你需要放在框架里的页面,我这里只是像“这是第二页”简单的几行说明文字
home.html是你的主页
help.html是下面那个框架显示的页面,主要是为了说明用JavaScript切换锚点。代码如下:
<html>
<body>
<a name="help1">这是锚点1</a>
<hr><hr><hr><hr><hr><hr><hr><hr>
<a name="help2">这是锚点2</a>
<hr><hr><hr><hr><hr><hr><hr><hr>
<a name="help3">这是锚点3</a>
<hr><hr><hr><hr><hr><hr><hr><hr>
<a name="help4">这是锚点4</a>
<hr><hr><hr><hr><hr><hr><hr><hr>
<a name="help5">这是锚点5</a>
<hr><hr><hr><hr><hr><hr><hr><hr>
<hr><hr><hr>
</body>
</html>