<!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=gb2312" />
<meta http-equiv="Content-Language" content="zh-CN" />
<title> New Document </title>
<script language="javascript">
//菜单隐藏与显示
function SwitchMenu(obj){
if(document.getElementById){
var el = document.getElementById("Menu_"+obj);
var ar = document.getElementById("Menu").getElementsByTagName("ul");
if(el.style.display != "block"){
for (var i=0; i<ar.length; i++){
if (ar[i].className=="submenu")
ar[i].style.display = "none";
document.getElementById("Menu"+(i+1)).className="Menutbg_1 cursor"
}
el.style.display = "block";
document.getElementById("Menu"+obj).className="Menutbg_2 cursor"
}else{
el.style.display = "none";
document.getElementById("Menu"+obj).className="Menutbg_1 cursor"
}
}
}
</script>
<style type="text/css">
<!--
body{font-family: "宋体";font-size:12px;}
#Menu{width:140px;border:#B1DCF4 1px solid;border-top:none;position:absolute;top:50%;left:50%;margin:-100px 0 0 -100px;}
.cursor{cursor:pointer;}
.submenu{display: none;}
.Menutbg_1{background:#090 ;display: block;width:140px;height:30px;line-height:30px;border:#B1DCF4 1px solid;text-align:center;font-weight: bold;letter-spacing:3px;}
.Menutbg_2{background:#FF0 ;display: block;width:140px;height:30px;line-height:30px;border:#B1DCF4 1px solid;text-align:center;font-weight: bold;color:#0F6599;letter-spacing:3px;}
-->
</style>
</head>
<body>
<div id="Menu">
<div id="Menu1" class="Menutbg_1 cursor" οnclick="SwitchMenu('1')">一级菜单A</div>
<ul id="Menu_1" class="submenu">
<li><a href="a1.htm">A1</a></li>
<li><a href="a2.htm">A2</a></li>
<li><a href="a3.htm">A3</a></li>
<li><a href="a4.htm">A4</a></li>
</ul>
<div id="Menu2" class="Menutbg_1 cursor" οnclick="SwitchMenu('2')">一级菜单B</div>
<ul id="Menu_2" class="submenu">
<li><a href="b1.htm">B1</a></li>
<li><a href="b2.htm">B2</a></li>
</ul>
<div id="Menu3" class="Menutbg_1 cursor" οnclick="SwitchMenu('3')">一级菜单C</div>
<ul id="Menu_3" class="submenu">
<li><a href="c1.htm">C1</a></li>
<li><a href="c2.htm">C2</A></li>
</ul>
</div>
</body>
<html xmlns=" http://www.w3.org/1999/xhtml ">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<meta http-equiv="Content-Language" content="zh-CN" />
<title> New Document </title>
<script language="javascript">
//菜单隐藏与显示
function SwitchMenu(obj){
if(document.getElementById){
var el = document.getElementById("Menu_"+obj);
var ar = document.getElementById("Menu").getElementsByTagName("ul");
if(el.style.display != "block"){
for (var i=0; i<ar.length; i++){
if (ar[i].className=="submenu")
ar[i].style.display = "none";
document.getElementById("Menu"+(i+1)).className="Menutbg_1 cursor"
}
el.style.display = "block";
document.getElementById("Menu"+obj).className="Menutbg_2 cursor"
}else{
el.style.display = "none";
document.getElementById("Menu"+obj).className="Menutbg_1 cursor"
}
}
}
</script>
<style type="text/css">
<!--
body{font-family: "宋体";font-size:12px;}
#Menu{width:140px;border:#B1DCF4 1px solid;border-top:none;position:absolute;top:50%;left:50%;margin:-100px 0 0 -100px;}
.cursor{cursor:pointer;}
.submenu{display: none;}
.Menutbg_1{background:#090 ;display: block;width:140px;height:30px;line-height:30px;border:#B1DCF4 1px solid;text-align:center;font-weight: bold;letter-spacing:3px;}
.Menutbg_2{background:#FF0 ;display: block;width:140px;height:30px;line-height:30px;border:#B1DCF4 1px solid;text-align:center;font-weight: bold;color:#0F6599;letter-spacing:3px;}
-->
</style>
</head>
<body>
<div id="Menu">
<div id="Menu1" class="Menutbg_1 cursor" οnclick="SwitchMenu('1')">一级菜单A</div>
<ul id="Menu_1" class="submenu">
<li><a href="a1.htm">A1</a></li>
<li><a href="a2.htm">A2</a></li>
<li><a href="a3.htm">A3</a></li>
<li><a href="a4.htm">A4</a></li>
</ul>
<div id="Menu2" class="Menutbg_1 cursor" οnclick="SwitchMenu('2')">一级菜单B</div>
<ul id="Menu_2" class="submenu">
<li><a href="b1.htm">B1</a></li>
<li><a href="b2.htm">B2</a></li>
</ul>
<div id="Menu3" class="Menutbg_1 cursor" οnclick="SwitchMenu('3')">一级菜单C</div>
<ul id="Menu_3" class="submenu">
<li><a href="c1.htm">C1</a></li>
<li><a href="c2.htm">C2</A></li>
</ul>
</div>
</body>
</html>
原文地址:http://blog.163.com/liushangfeng_ryl@126/blog/static/15783270200852531212669/