鼠标移动现实二级菜单

Posted 徐文昊

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了鼠标移动现实二级菜单相关的知识,希望对你有一定的参考价值。

*{ margin:opx auto; padding:0px;}

 #leibie{ width:500px; height:36px; border:1px solid #03F;}

 .yuyan{ float:left; width:100px; height:36px; text-align:center; line-height:36px; vertical-align:middle; font-weight:bold;}

  .yuyan:hover{ cursor:pointer; background-color:#96C; color:white;}

 #yuyan2{ width:100px; height:100px; position:relative; top:36px; left:-100px; background-color:#0F0; display:none}

 #yuyan3{ width:100px; height:100px; position:relative; top:36px; left:-100px; background-color:#FF0; display:none}

 #yuyan4{ width:100px; height:100px; position:relative; top:36px; left:-100px; background-color:#0FF; display:none}

 #yuyan5{ width:100px; height:100px; position:relative; top:36px; left:-100px; background-color:#F00; display:none}

       </style>

<body>

<div id="leibie">

  <div class="yuyan" onmouseover="xianshi(‘yuyan2‘)" onmouseout="yincang(‘yuyan2‘)">.net</div>

    <div style="float:left; width:0px">

        <div id="yuyan2"></div>

        </div>

  <div class="yuyan" onmouseover="xianshi(‘yuyan3‘)"onmouseout="yincang(‘yuyan3‘)">java</div>

    <div style="float:left; width:0px">

        <div id="yuyan3"></div>

        </div>

  <div class="yuyan" onmouseover="xianshi(‘yuyan4‘)" onmouseout="yincang(‘yuyan4‘)">php</div>

    <div style="float:left; width:0px">

        <div id="yuyan4"></div>

        </div>

  <div class="yuyan" onmouseover="xianshi(‘yuyan5‘)" onmouseout="yincang(‘yuyan5‘)">ios</div>

    <div style="float:left; width:0px">

        <div id="yuyan5"></div>

        </div>

</div>

</body>

<script type="application/javascript">

function xianshi(d)

{

 var aa = document.getElementById(d);

  aa.style.display = "block";

}  

function yincang(d)

  {   

var aa = document.getElementById(d)

   aa.style.display="none";

   }  

</script>

以上是关于鼠标移动现实二级菜单的主要内容,如果未能解决你的问题,请参考以下文章

二级菜单,鼠标一移开一级,二级菜单马上隐藏,二级菜单的内容根本点不了,请问如何解决?

鼠标事件-二级菜单

html 二级菜单怎么让鼠标移动到二级,三级。。。的时候,一级样式不改变。当移出的时候改变。

js实现鼠标滑过显示二级菜单

html框架左侧导航栏如何实现移动鼠标显示二级菜单

到二级菜单怎样鼠标离开一级菜单后二级菜单不消失