<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default2.aspx.cs" Inherits="Default2" %>
<!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>
<title>通用的二级菜单</title>
<style type="text/css">
#menu
{
width:300px;
margin:auto;
}
#div1
{
display:none;
font-size:12px;
position:relative;
left:0px;
top:0px;
background-color:White;
padding:5px 10px 0px 10px;
width:320px;
}
#div2
{
display:none;
font-size:12px;
position:relative;
left:50px;
top:0px;
background-color:White;
padding:5px 10px 0px 10px;
width:320px;
}
#div3
{
display:none;
font-size:12px;
position:relative;
left:120px;
top:0px;
background-color:White;
padding:5px 10px 0px 10px;
width:320px;
}
#div4
{
display:none;
font-size:12px;
position:relative;
left:200px;
top:0px;
background-color:White;
padding:5px 10px 0px 10px;
width:320px;
}
</style>
<script language="javascript" type="text/javascript">
//显示层
function showDiv(divName) {
document.getElementById(divName).style.display = "block";
}
//隐藏层
function hiddenDiv(divName) {
document.getElementById(divName).style.display = "none";
}
</script>
</head>
<body>
<div id="menu">
<a href="#" οnmοuseοver="showDiv('div1')" οnmοuseοut="hiddenDiv('div1')">菜单一</a>
|
<a href="#" οnmοuseοver="showDiv('div2')" οnmοuseοut="hiddenDiv('div2')">菜单二</a>
|
<a href="#" οnmοuseοver="showDiv('div3')" οnmοuseοut="hiddenDiv('div3')">菜单三</a>
|
<a href="#" οnmοuseοver="showDiv('div4')" οnmοuseοut="hiddenDiv('div4')">菜单四</a>
<div id="div1" οnmοuseοver="showDiv(this.id)" οnmοuseοut="hiddenDiv(this.id)">
<a href="#">子菜单一</a>
</div>
<div id="div2" οnmοuseοver="showDiv(this.id)" οnmοuseοut="hiddenDiv(this.id)">
<a href="#">子菜单一</a>
<a href="#">子菜单二</a>
</div>
<div id="div3" οnmοuseοver="showDiv(this.id)" οnmοuseοut="hiddenDiv(this.id)">
<a href="#">子菜单一</a>
<a href="#">子菜单二</a>
<a href="#">子菜单三</a>
</div>
<div id="div4" οnmοuseοver="showDiv(this.id)" οnmοuseοut="hiddenDiv(this.id)">
<a href="#">子菜单一</a>
<a href="#">子菜单二</a>
<a href="#">子菜单三</a>
<a href="#">子菜单四</a>
</div>
</div>
</body>
</html>