</html>
'use strict'; // alert("ha"); window.οnlοad=function () { var oLi=document.getElementById('list'); var oSpan=document.getElementsByClassName('spanDown')[0]; var o=document.getElementById('menu'); // console.log(oUlLi[0].className); // console.log(oUlLi[4].className); var i=0; oLi.οnclick=function () { if(oSpan.className=='spanUp') { var oUlLi=document.getElementsByClassName('lc2'); console.log(oUlLi.length); console.log("chandu:"+oUlLi.length); // console.log("chandu:"+oUlLi.length); oSpan.className='spanDown'; o.id='menu'; // alert(oUlLi.length); for(i=0;i<6;i++) { // console.log(oUlLi.length); // if(oUlLi.length>0) oUlLi[0].className='lc1'; } } else { var oUlLi=document.getElementsByClassName('lc1'); console.log(oUlLi.length); oSpan.className='spanUp'; o.id='menu1'; // alert(oUlLi.length); for(i=0;i<6;i++) { // oUlLi[0].className=''; oUlLi[0].className='lc2'; console.log('ha'); } } } }
#menu { margin: 40px auto; background-color: #e9edf2; list-style: none; width: 200px; padding-left: 0; height: 175px; color: #57646e; position: relative; } #menu1 { margin: 40px auto; background-color: white; list-style: none; width: 200px; padding-left: 0; height: 175px; color: #57646e; position: relative; } #list { /* background-color: ; */ background-color: #dee3e6; } .spanDown { background-image:url(img/up.gif); background-repeat: no-repeat; width: 10px; height: 5px; position: absolute; left:150px; top: 10px; } .spanUp { background-image:url(img/down.gif); background-repeat: no-repeat; width: 10px; height: 5px; position: absolute; left:150px; top: 10px; /* top: px; */ /* background-color: red; */ } /* .spanUp img { background-image: url(img/down_list_h2_bg.gif); background-repeat: no-repeat; width: 10px; height: 5px; position: relative; left: 100px; } */ ul li,ul div { /* position: absolute; */ height: 25px; /* margin:auto 0; */ /* background-color: red; */ /* width: 200px; */ /* padding-left: 0; */ /* background-color: red; */ } ul li a { text-decoration: none; } ul .lc1:hover {background-color: white; text-decoration: underline; } .lc2 { display: none; background-color: white; }