<style>
.h,.e {list-style-type: none; float:left;}
.h div,.e div{background-color:gray; padding:2px 20px;margin:1px;}
#h1,#e1{background-color:yellow; padding:2px 20px;margin:5px; visibility:hidden;
}
<ul>
<li class="h">
<div id="h">Home</div>
<ul class="h1" id="h1"><li>H1</li><li>H2</li><li>H3</li><li>H4</li></ul>
</li>
<li class="e">
<div id="e">Exit</div>
<ul class="e1" id="e1"><li>E1</li><li>E2</li><li>E3</li><li>E4</li></ul>
</li>
<ul>
<script>
var oh = document.getElementById("h");
var oe = document.getElementById("e");
var oh1 = document.getElementById("h1");
var oe1 = document.getElementById("e1");
oh.onmouseover=function(){oh1.style.visibility="";};
oe.onmouseover=function(){oe1.style.visibility="";};
</script>
在鼠标悬停时,我想显示 id=h1,e1 项目,但它不起作用....,代码出了什么问题?