<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<style>
width: 200px;
height: auto;
border: 1px solid lightsalmon;
}
ul >li{
list-style: none;
position: relative;
}
ul>li>ul{
margin: 0px auto;
}
ul >li>a {
text-decoration: none;
}
.menu{
display: none;
}
</style>
<script>
window.onload= function () {
var AllMenuLi=document.getElementsByClassName('first');
var i=0;
for(i=0;i<AllMenuLi.length;i++)
{
AllMenuLi[i].onclick= function () {
// alert("sss");
var UlMenuLi=this.getElementsByTagName("ul")[0];
if(UlMenuLi.className=='menu')
{
UlMenuLi.className='';
}
else {
UlMenuLi.className='menu';
}
};
}
};
</script>
</head>
<body>
<ul id="ul1">
<li><a href="#">about us</a></li>
<li><a href="#" >learn more</a></li>
<li class="first"><a href="#">show information</a>
<ul class="menu">
<li><a href="#">asdksdk</a> </li>
<li><a href="#">asdksdk</a> </li>
<li><a href="#">asdksdk</a> </li>
</ul>
</li>
<li><a href="#">dddkssss</a> </li>
<li class="first"><a href="#">dkkkkk</a>
<ul class="menu">
<li><a href="#">aaaaasdk</a> </li>
<li><a href="#">aaavvvv</a> </li>
<li><a href="#">ccccccc</a> </li>
</ul>
</li>
</ul>
</body>
</html>