各大门户网站流行的菜单表格

本文介绍了一种使用 HTML 和 JavaScript 实现的菜单和内容显示效果。通过简单的鼠标悬停操作即可改变菜单样式并展示不同内容面板。此方案适用于初学者了解基本网页交互设计。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

<!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;
}

{
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"><href="#">菜单</a></td>
    
<td onmouseover="fod(this,'fd1')"><href="#">菜单</a></td>
    
<td onmouseover="fod(this,'fd1')"><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"><href="#">菜单</a></td>
    
<td onmouseover="fod(this,'fd2')"><href="#">菜单</a></td>
    
<td onmouseover="fod(this,'fd2')"><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>
 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值