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>
<style type="text/css" >
#tabMenu a{
	background-color:#ccc;//背景颜色灰色
	text-decoration:none;//无下划线
	width:200px;
	height:30px;
	text-align:center;//文字左右居中
	line-height:30px;//文字上下居中
	border:1px solid white;//边框
	color:black;
	display:block;//block是有结构的,inline是没有结构的(无宽和高)
}
#tabMenu a:hover{
background:#F00;
color:#FFF;
}
.divMenu{
	display:none; //设置为隐藏
	z-index:9px;//设置级别为9,
	position:absolute;/设置为绝对定位
}
</style>
<script type="text/javascript" language="javascript">
function showMenu(obj){
	document.getElementById("Menu"+obj).style.display="block";
}
function hideMenu(obj){
	document.getElementById("Menu"+obj).style.display="none";
}

</script>
</head>


<body>
<table id="tabMenu" cellpadding="0" cellspacing="0" border="0">
	<tr>
    	<td><a href="#" onmouseover="showMenu(1);" onmouseout="hideMenu(1);">公司首页</a>
     	</td>
        <td><a href="#" onmouseover="showMenu(2);" onmouseout="hideMenu(2);">新闻中心</a>
     	</td>
        <td><a href="#" onmouseover="showMenu(3);" onmouseout="hideMenu(3);">产品首页</a>
     	</td>
    </tr>
    <tr>
    	<td>
        	<div id="Menu1" class="divMenu" onmousemove="showMenu(1);" onmouseout="hideMenu(1);">
            	<a href="#"/>公司首页1</a>
                <a href="#"/>公司首页1</a>
                <a href="#"/>公司首页1</a>
                <a href="#"/>公司首页1</a>
                <a href="#"/>公司首页1</a>
            </div>
        </td>
        <td>
        	<div id="Menu2" class="divMenu" onmousemove="showMenu(2);" onmouseout="hideMenu(2);">
            	<a href="#"/>产品首页1</a>
                <a href="#"/>产品首页1</a>
                <a href="#"/>产品首页1</a>
                <a href="#"/>产品首页1</a>
                <a href="#"/>产品首页1</a>
            </div>
        </td>
        <td>
        	<div id="Menu3" class="divMenu" onmousemove="showMenu(3);" onmouseout="hideMenu(3);">
            	<a href="#"/>新闻首页1</a>
                <a href="#"/>新闻首页1</a>
                <a href="#"/>新闻首页1</a>
                <a href="#"/>新闻首页1</a>
                <a href="#"/>新闻首页1</a>
            </div>
        </td>
    </tr>
    
</table>
<img src="advpic.gif"/>
</body>
</html>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值