zoukankan      html  css  js  c++  java
  • html 树形菜单

     1 <html>
     2     <head>
     3         <style>
     4             #d1{
     5                 width:200;
     6                 height:400;
     7                 background-color:#cccccc;
     8                 border:2px solid black;
     9                 left:30;
    10                 top:30;
    11                 position:absolute;
    12             }
    13             #d1_head{
    14                 height:30;
    15                 background-color:blue;
    16                 color:white;
    17                 font-size:20pt;
    18             }
    19             #d1_body{
    20                 background-color:#cccccc;
    21             }
    22         </style>
    23         <script>
    24             function doAction(index){
    25                 var obj = document.getElementById('u' + index);
    26                 if(obj.style.display == 'none'){
    27                         obj.style.display = 'block';
    28                 }else{
    29                         obj.style.display = 'none';
    30                 }
    31             }
    32             
    33             function test(){
    34                 var obj = document.getElementById('l1');
    35                 alert(obj.innerHTML);
    36             }
    37         </script>
    38     </head>
    39     <body style="font-size:20pt;">
    40         <div id="d1">
    41             <div id="d1_head">菜单</div>
    42             <div id="d1_body">
    43                 <ul>
    44                     <li>
    45                         <span onclick="doAction(1);">menu1</span>
    46                     </li>
    47                     <ul style="display:none;" id="u1">
    48                         <li><a href="#">item1</a></li>
    49                         <li><a href="#">item2</a></li>
    50                     </ul>
    51                     <li>
    52                         <span onclick="doAction(2);">menu2</span>
    53                     </li>
    54                     <ul style="display:none;" id="u2">
    55                         <li><a href="#">item1</a></li>
    56                         <li><a href="#">item2</a></li>
    57                     </ul>
    58                 </ul>
    59             </div>
    60         </div>
    61     </body>
    62 </html>
  • 相关阅读:
    centos7的网络设置
    day1学习
    举例讲解Linux系统下Python调用系统Shell的方法
    Python引用模块和查找模块路径
    详解Python中的循环语句的用法
    [cf1566H]Xorquiz
    [luogu5180]支配树
    [atAGC055D]ABC Ultimatum
    [cf1552H]A Serious Referee
    [gym102538H]Horrible Cycles
  • 原文地址:https://www.cnblogs.com/smile361/p/2649456.html
Copyright © 2011-2022 走看看