二级菜单

把主页面都做的差不多了,就差图片轮播了,二级菜单还是用hidden做的,因为有些菜单是一直显示在那的,用二级菜单不太好弄哇 hidden虽然麻烦点,但效果还是挺不错的

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
<style>
.listdiv{
top:20px;
position: absolute;
}




</style>
</head>
<body>
<span class="a">11111</span>
<span class="b">22222</span>
<span class="c">333333</span>
<div class="a1" >
<p>12311111111111111111</p>
<p>12311111111111111111</p>
<p>12311111111111111111</p>
<p>12311111111111111111</p></div>
<div class="b1" hidden="hidden">
<p>23122222222222222222</p>
<p>23122222222222222222</p>
<p>23122222222222222222</p>
<p>23122222222222222222</p></div>
<div class="c1" hidden="hidden">
<p>32133333333333333333</p>
<p>32133333333333333333</p>
<p>32133333333333333333</p>
<p>32133333333333333333</p></div>
</body>
</html>
<script>

a=document.getElementsByClassName("a")[0];
b=document.getElementsByClassName("b")[0];
c=document.getElementsByClassName("c")[0];
a1=document.getElementsByClassName("a1")[0];
b1=document.getElementsByClassName("b1")[0];
c1=document.getElementsByClassName("c1")[0];

a.onmouseover=function(){
b1.setAttribute("hidden","hidden")
c1.setAttribute("hidden","hidden")
a1.removeAttribute("hidden");

}

b.onmouseover=function(){
a1.setAttribute("hidden","hidden")
c1.setAttribute("hidden","hidden")
b1.removeAttribute("hidden");

}

c.onmouseover=function(){
a1.setAttribute("hidden","hidden")
b1.setAttribute("hidden","hidden")
c1.removeAttribute("hidden");

}


</script>

原文地址:https://www.cnblogs.com/m110/p/7624565.html