zoukankan      html  css  js  c++  java
  • 收缩展开的竖直菜单(利用JS+CSS实现_网页代码站(www.webdm.cn)

    1 <html>
    2 <head>
    3 <title>收缩展开的竖直菜单(利用JS+CSS实现_网页代码站(www.webdm.cn)</title>
    4 <script language="JavaScript">
    5 NS4 = (document.layers) ? 1 : 0;
    6 IE4 = (document.all) ? 1 : 0;
    7 ver4 = (NS4 || IE4) ? 1 : 0;
    8 if (ver4) {
    9 with (document) {
    10 write("<STYLE TYPE='text/css'>");
    11 if (NS4) {
    12 write(".parent {position:absolute; visibility:visible}");
    13 write(".child {position:absolute; visibility:visible}");
    14 write(".regular {position:absolute; visibility:visible}")
    15 }
    16 else {
    17 write(".child {display:none}")
    18 }
    19 write("</STYLE>");
    20 }
    21 }
    22 function arrange() {
    23 nextY = document.layers[firstInd].pageY +document.layers[firstInd].document.height;
    24 for (i=firstInd+1; i<document.layers.length; i++) {
    25 whichele = document.layers[i];
    26 if (whichele.visibility != "hide") {
    27 whichele.pageY = nextY;
    28 nextY += whichele.document.height;
    29 }
    30 }
    31 }
    32 function initIt(){
    33 if (!ver4) return;
    34 if (NS4) {
    35 for (i=0; i<document.layers.length; i++) {
    36 whichele = document.layers[i];
    37 if (whichele.id.indexOf("Child") != -1) whichele.visibility = "hide";
    38 }
    39 arrange();
    40 }
    41 else {
    42 divColl = document.all.tags("DIV");
    43 for (i=0; i<divColl.length; i++) {
    44 whichele = divColl(i);
    45 if (whichele.className == "child") whichele.style.display = "none";
    46 }
    47 }
    48 }
    49 function expandIt(ele) {
    50 if (!ver4) return;
    51 if (IE4) {
    52 whichele = eval(ele + "Child");
    53 if (whichele.style.display == "none") {
    54 whichele.style.display = "block";
    55 }
    56 else {
    57 whichele.style.display = "none";
    58 }
    59 }
    60 else {
    61 whichele = eval("document." + ele + "Child");
    62 if (whichele.visibility == "hide") {
    63 whichele.visibility = "show";
    64 }
    65 else {
    66 whichele.visibility = "hide";
    67 }
    68 arrange();
    69 }
    70 }
    71 onload = initIt;
    72 </script>
    73 </head>
    74 <body>
    75 <div id="menuParent" class="parent">    <a href="#" onClick="expandIt('menu'); return false" >第一菜单</a></div>
    76 <div id="menuChild" class="child">     <a href="http://www.webdm.cn" target="_blank" >CSS菜单</a><br>
    77      <a href="/" target="_blank" >网页特效</a><br>
    78      <a href="/" target="_blank" >电子书籍</a></div>
    79 <div id="Menu2Parent" class="parent">    <a href="#" onClick="expandIt('Menu2'); return false" >第二菜单</a></div>
    80 <div id="Menu2Child" class="child">     <a href="/" target="_blank" >源码下载</a><br>
    81      <a href="/" target="_blank" >站长工具</a><br>
    82      <a href="/" target="_blank" >教程天地</a></div>
    83 <div id="Menu3Parent" class="parent">    <a href="#" onClick="expandIt('Menu3'); return false" >第三菜单</a></div>
    84 <div id="Menu3Child" class="child">      <a href="#" target="_blank" >自定义一</a><br>
    85      <a href="#" target="_blank" >自定义二</a><br>
    86      <a href="#" target="_blank" >自定义三</a></div>
    87 </body>
    88 </html>
    89 <a href="http://www.webdm.cn">网页代码站</a> - 最专业的代码下载网站 - 致力为中国站长提供有质量的代码!

    文章来自:http://www.webdm.cn/webcode/f7adc0f5-5342-4bb9-b1dd-e2c6659cedf7.html

  • 相关阅读:
    Java项目远程调试
    Linux虚拟机安装
    研究Quarkus出现的各种错误集锦
    debian 安装 ifconfig ping
    adb shell pm list packages 高级用法
    2020年深港澳金融科技师专才计划一级考试报名简章
    k8s组件
    查询Kubernetes中etcd数据
    curl
    kubelet
  • 原文地址:https://www.cnblogs.com/webdm/p/1905346.html
Copyright © 2011-2022 走看看