首页 > 代码库 > python : HTML+CSS (左侧菜单)
python : HTML+CSS (左侧菜单)
左侧菜单
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <title>Title</title> <style> .hide{ display: none; } .menu .head{ height:38px; background-color: #2459a2; line-height: 38px; } </style> </head> <body> <div style="height: 48px ;border: 1px solid red"></div> <div style="width:300px ;border: 1px solid red "> <div class="menu"> <div id=‘a1‘ class="head " onclick="caidan(‘a1‘)">菜单1</div> <div class="conent"> <div clas="item">内容1</div> <div clas="item">内容1</div> <div clas="item">内容1</div> </div> </div> <div class="menu"> <div id=‘a2‘ class="head " onclick="caidan(‘a2‘)">菜单2</div> <div class="conent hide"> <div clas="item">内容2</div> <div clas="item">内容2</div> <div clas="item">内容2</div> </div> </div> <div class="menu"> <div id=‘a3‘ class="head" onclick="caidan(‘a3‘)">菜单3</div> <div class="conent hide"> <div clas="item">内容3</div> <div clas="item">内容3</div> <div clas="item">内容3</div> </div> </div> <div class="menu"> <div id=‘a4‘ class="head" onclick="caidan(‘a4‘)">菜单4</div> <div class="conent hide"> <div clas="item">内容4</div> <div clas="item">内容4</div> <div clas="item">内容4</div> </div> </div> </div> <script> function caidan(nod) { var head=document.getElementById(nod); curr_meu=head.parentElement.parentElement.children; for (var i=0; i<curr_meu.length; i++){ var item_list=curr_meu[i]; item_list.children[1].classList.add(‘hide‘); } head.nextElementSibling.classList.remove(‘hide‘) } </script> </body> </html>
python : HTML+CSS (左侧菜单)
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。