1个回答
展开全部
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>
RunJS 演示代码
</title>
<style>
ul.main>li>ul{
display:none;
}
</style>
<script>
var last;
onload=function(){
var as = document.querySelectorAll("ul.main>li");
for(var i=0;i<as.length;i++){
as[i].onmouseenter = function(){
last ? last.style.display = 'none' : 0;
var ul = this.querySelector("ul");
ul.style.display ='block';
last = ul;
}
}
}
</script>
</head>
<body>
<ul class="main">
<li>
<a>
sdfsdf
</a>
<ul>
<ol>
111
</ol>
<ol>
222
</ol>
</ul>
</li>
<li>
<a>
sdfsdf
</a>
<ul>
<ol>
111
</ol>
<ol>
222
</ol>
</ul>
</li>
<li>
<a>
sdfsdf
</a>
<ul>
<ol>
111
</ol>
<ol>
222
</ol>
</ul>
</li>
</ul>
</body>
</html>
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询