zoukankan      html  css  js  c++  java
  • 简单易用的点击展开伸缩效果

    <SCRIPT>
    function openP(_id)
        {
           var select_id = parseInt(_id.replace("box",""));
           for (i=1;i<=4;i++)
           {
              if (i==select_id)
              {
                  document.getElementById("box"+i).style.display = "block";
              }
              else
              {
                 document.getElementById("box"+i).style.display = "none";
              }
           }
        }
    </SCRIPT>
     1 <a href="###" onmouseover="openP('box1')">1、点击展开1</a>
     2 <p id="box1">
     3    这里面放的是box1的内容.
     4 </p>
     5 <p><a href="###" onmouseover="openP('box2')">2、点击展开2</a></p>
     6 <p id="box2" style="display:none">
     7    这里面放的是box2的内容.
     8 </p>
     9 <a href="###" onmouseover="openP('box3')">3、点击展开3</a>
    10 <p id="box3" style="display:none">
    11    这里面放的是box3的内容.
    12 </p>
    13 <p><a href="###" onmouseover="openP('box4')">4、点击展开4</a></p>
    14 <p id="box4" style="display:none">
    15    这里面放的是box4的内容.
    16 </p>
    17 <br />
    18 <p><a href="http://www.webdm.cn">网页代码站</a> - 最专业的网页代码下载网站 - 致力为中国站长提供有质量的网页代码!</p>

     实例:

    function showlist (_id) {
                  //列表显示
                var aMenu = document.getElementsByClassName("menu")[0], aDt = aMenu.getElementsByTagName("dt");
                var len = aDt.length;
                var select_id = parseInt(_id.replace("month", ""));
                    for (i = 1; i <= len; i++) {
                        if (i == select_id) {
                            document.getElementById("month" + i).style.display = "block";
                        }
                        else {
                            document.getElementById("month" + i).style.display = "none";
                        }
                }
                }

    调用:

    <dt onmouseover="showlist('month1')"><ul class="month"><li class="w288 textLeft">3月集合</li><li>2</li><li>0</li><li>0</li><li>0</li><li>0</li><li>0</li><li>0</li></ul></dt>
  • 相关阅读:
    O052、Create Volume 操作 (Part III)
    O051、Create Volume 操作 (Part II)
    O050、Create Volume 操作 (Part I)
    O049、准备 LVM Volume Provider
    O048、掌握 cinder-scheduler 调度逻辑
    O047、 Cinder 组件详解
    O046、掌握Cinder 的设计思想
    O045、理解 Cinder 架构
    O044、一张图秒懂 Nova 16种操作
    O043、计算节点宕机了怎么办
  • 原文地址:https://www.cnblogs.com/q460021417/p/4335262.html
Copyright © 2011-2022 走看看