我想在有两个iframe的情况下创建内容页面。一个iframe是一个带按钮或链接的浮动sidemenu,而另一个iframe实际上包含内容。我希望用户能够点击sidemenu上的链接,如“图片”,然后让该链接更改其他iframe的内容。我还希望鼠标悬停在菜单上的每个标签(图像,家庭,阅读)的整个单元都会改变颜色。从另一个iframe中的链接加载iframe中的页面
我已经尝试了很多事情,但这里是代码的基础:
<html>
<head>
<title>Main Content Page</title>
</head>
<body background="background.jpg">
<table>
<th>
<iframe src="sidebar.html" frameborder="no" border="0" scrolling="no" height="750" width="450"></iframe>
<th>
<iframe id ="content" src="" frameborder="no" border="0" scrolling="no" width="600" height="800"></iframe>
</table>
</body>
</html>
,然后为内容的iframe无关紧要的页面。侧边栏的代码是:
<html>
<head>
<title>Main</title>
<base target="content">
<style type="text/css">
body{bgcolor: black;}
a{color: white}
a:link, a:visited{background-color: black}
<!--a:hover{background-color: gray}-->
<!--td:hover{background-color: gray}-->
buttons:hover{background-color: gray}
td, th{border:1px solid black; background-color:black;}
table{border:1px solid gray;}
td {font-family: Kunstler Script; color: white; font-size: 72; padding:15px;}
</style>
</head>
<body>
<table align="center">
<tr><div class="buttons"><div><td onclick="target.content.home.href='html'">Home</div>
<tr><div><td onclick="target.content.href='images.html'">Images</div>
<tr><div><td onclick="target.content.href='readings.html'">Readings</div></div>
</table>
</div>
</body>
</html>
眼下链接不工作,但按键就变色
那么,不要这样做,使用CSS固定位置http:// jsfi ddle.net/HerrSerker/fC2Zf/ – HerrSerker