Home  >  Article  >  Web Front-end  >  css+div做的菜单_html/css_WEB-ITnose

css+div做的菜单_html/css_WEB-ITnose

WBOY
WBOYOriginal
2016-06-24 12:33:381260browse

css+div做的菜单:一个主显示层,别的列表都隐藏着,用js函数设置列表的显示和隐藏。分别用到了两个函数,函数实现的效果是一样的,一个是参考的《css+Dhtml精髓》书上的事例,一个是找的函数。
第一个函数
              function showMenu(layerName)
              {
                     // show the layer the user wants to see
                     eval(layerRef + layerName + endLayerRef + styleRef + ".visibility = 'visible'");
                     }
              function hiddenMenu(layerName)
              {
                     // hidden the layer  
                     eval(layerRef + layerName + endLayerRef + styleRef + ".visibility = 'hidden'");
                     }
                     
                     //第一个函数
                     
第二个函数
function MM_showHideLayers()
       {
              var i,p,v,obj,args=MM_showHideLayers.arguments;
              for (i=0; i                      if ((obj=MM_findObj(args[i]))!=null)
                     {
                            v=args[i+2];
                            if (obj.style)
                            {
                                   obj=obj.style;
                                   v=(v=='show')?'visible' v='hide')?'hidden':v;
                            }
                            obj.visibility=v;
                     }
       }

         function MM_findObj(n, d)
       {
              var p,i,x;
              if(!d)
                     d=document;
              if((p=n.indexOf("?"))>0&&parent.frames.length)
              {
                     d=parent.frames[n.substring(p+1)].document;
                     n=n.substring(0,p);
              }
              if(!(x=d[n])&&d.all)
                     x=d.all[n];
              for (i=0;!x&&i                      x=d.forms[i][n];
              for(i=0;!x&&d.layers&&i                      x=MM_findObj(n,d.layers[i].document);
              if(!x && document.getElementById)
                     x=document.getElementById(n);
              return x;
       }
       //第二个函数







Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn