varRea = document.getElementById ("rep"); varReaall = Rea.queryselectorall ("li"); varFall = document.getElementById ("Fall"); varFallall = Fall.queryselectorall ("ul"); for(vari=0;i<reaall.length;i++) {reaall[i].index=i; Reaall[i].onclick=function(){ for(vari=0;i<reaall.length;i++) {reaall[i].classname=" "; Fallall[i].style.display= "none"; } this. classname= "avtion"; fallall[ this. index].style.display= "block"; } }
<ul class= "row rep_ad" id= "rep" > <li cl ass= "avtion" > Announcements </li> <li> Knowledge Base </li> </ul> <div id= "fall" > <ul Style= "display:block;" > <li>11111111111111111</li> <li>11111111111111111</li> <li>11111111111111111</ Li> <li>11111111111111111</li> <li>11111111111111111</li> </ul> <ul> <li>22222222222222222</li> <li>22222222222222222</li> <li>2 2222222222222222</li> <li>22222222222222222</li> <li>22222222222222222</li> </ul> </div> </div>
You can understand it at a glance. Get up!
JS OST quick Implementation tab