<!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>
<style type="text/css">...

/**//*菜单表格*/
.menutable {...}{
background-color:#FFD2DC;
border-top:1px solid #CE1733;
border-right:1px solid #CE1733;
border-spacing:0px;
border-collapse:collapse;
}
.menutable td {...}{
border-bottom:1px solid #CE1733;
border-left:1px solid #CE1733;
font-size:10pt;
text-align:center;
cursor:pointer;
}
.menutable td.focus {...}{
background-color:#FFFFFF;
border-bottom:1px solid #FFFFFF;
}

a:hover {...}{
text-decoration: underline;
}
a {...}{
font-size: 10pt;
color: #000000;
text-decoration: none;
}

/**//*内容表格*/
.infotable
{...}{
border-left:1px solid #CE1733;
border-right:1px solid #CE1733;
border-bottom:1px solid #CE1733;
border-spacing:0px;
border-collapse:collapse;
}
.dis {...}{
display:block;
}
.undis {...}{
display:none;
}
</style>
<script type="text/javascript">...
function fod(target,panel)
...{
target.className="focus";
var p = target.parentNode.getElementsByTagName("td");
var dlist = document.getElementById(panel).getElementsByTagName("div");
for(i=0;i<p.length;i++)
...{
if(p[i] == target)
...{
p[i].className="focus";
dlist[i].className="dis";
}
else
...{
p[i].className="";
dlist[i].className="undis";
}
}
}
</script>
</head>
<body>
<table width="200" class="menutable">
<tr>
<td onmouseover="fod(this,'fd1')" class="focus"><a href="#">菜单</a></td>
<td onmouseover="fod(this,'fd1')"><a href="#">菜单</a></td>
<td onmouseover="fod(this,'fd1')"><a href="#">菜单</a></td>
</tr>
</table>
<table width="200" class="infotable" height="70">
<tr>
<td id="fd1">
<div class="dis">
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr>
<td>table1</td>
</tr>
</table>
</div>
<div class="undis">
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr>
<td>table2</td>
</tr>
</table>
</div>
<div class="undis">
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr>
<td>table3</td>
</tr>
</table>
</div>
</td>
</tr>
</table>
<p/>
<table width="200" class="menutable">
<tr>
<td onmouseover="fod(this,'fd2')" class="focus"><a href="#">菜单</a></td>
<td onmouseover="fod(this,'fd2')"><a href="#">菜单</a></td>
<td onmouseover="fod(this,'fd2')"><a href="#">菜单</a></td>
</tr>
</table>
<table width="200" class="infotable" height="70">
<tr>
<td id="fd2">
<div class="dis">
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr>
<td>table1</td>
</tr>
</table>
</div>
<div class="undis">
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr>
<td>table2</td>
</tr>
</table>
</div>
<div class="undis">
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr>
<td>table3</td>
</tr>
</table>
</div>
</td>
</tr>
</table>
</body>
</html>
本文介绍了一种使用 HTML 和 JavaScript 实现的菜单和内容显示效果。通过简单的鼠标悬停操作即可改变菜单样式并展示不同内容面板。此方案适用于初学者了解基本网页交互设计。
3493

被折叠的 条评论
为什么被折叠?



