麻豆小视频在线观看_中文黄色一级片_久久久成人精品_成片免费观看视频大全_午夜精品久久久久久久99热浪潮_成人一区二区三区四区

首頁 > 編程 > JavaScript > 正文

javascript實現樹形菜單的方法

2019-11-20 12:01:56
字體:
來源:轉載
供稿:網友

本文實例講述了javascript實現樹形菜單的方法。分享給大家供大家參考。具體如下:

var ME={  ini:{i:true,d:{},d1:{},h:0,h1:0,h2:0},  html:function(da,f){    var s='<ul'+(f?' class="f"':'')+'>';    for(var i=0,l=da.length;i<l;i++){      if(typeof(da[i].pid)=='object'){        s+='<li><button type="button" class="'+(i==0&&this.ini.i?'s1':(i+1==l?'s5':'s3'))+'" onclick="ME.yc(this)"></button><span><button type="button" class="r1"></button><a href="javascript:;">'+da[i].ming+'</a></span>';        this.ini.i=false;        s+=this.html(da[i].pid,(i+1==l));      }else{        s+='<li><button type="button" class="'+(i+1==l?'e3':'e1')+'"></button><span><button type="button" class="m1"></button><a href="http://www.companysz.com" target="mainFrame">'+da[i].ming+'</a></span>';      }      s+='</li>';    }    s+='</ul>';    return s;  },  st:function(id,da){    document.getElementById(id).innerHTML=this.html(da);  },  yc:function(a){    var s=a.className.substr(1);    if(s%2){      this.ini.d=a.parentNode.children[2];      this.ini.h1=this.hei(this.ini.d);      this.ini.h3=this.ini.h1/10;      this.yc1(1);      a.className='s'+(parseInt(s)+1);      a.parentNode.children[1].children[0].className='r2';      var ol=a.parentNode.parentNode._;      if(typeof(ol)=='object'){        this.ini.d1=ol;        this.ini.h=ol.offsetHeight;        this.ini.h2=this.ini.h/10;        this.yc2(1);        ol.parentNode.children[0].className='s'+(parseInt(ol.parentNode.children[0].className.substr(1))-1);        ol.parentNode.children[1].children[0].className='r1';      }      a.parentNode.parentNode._=a.parentNode.children[2];    }else{      this.ini.d1=a.parentNode.children[2];      this.ini.h=this.ini.d1.offsetHeight;      this.ini.h2=this.ini.h/10;      this.yc2(1);      a.className='s'+(parseInt(s)-1);      a.parentNode.children[1].children[0].className='r1';      a.parentNode.parentNode._='';    }  },  yc1:function(b){    var h1=ME.ini.h1-(11/(b+1)-1)*ME.ini.h3;    with(ME.ini.d.style){      height=h1+'px';      display='block';    }    if(b<10){    setTimeout('ME.yc1('+(b+1)+')',25);    }else{    ME.ini.d.style.display='block';    ME.ini.d.style.height='';    }  },  yc2:function(b){    var h1=(11/(b+1)-1)*ME.ini.h2;    with(ME.ini.d1.style){      height=h1+'px';    }    if(b<10){    setTimeout('ME.yc2('+(b+1)+')',25);    }else{    ME.ini.d1.style.display='';    ME.ini.d1.style.height='';    }  },  hei:function(a){    var b=a.cloneNode(true);    b.style.position='absolute';     b.style.display='block';     b.style.visibility='hidden';    a.parentNode.appendChild(b);    var h=b.offsetHeight;    a.parentNode.removeChild(b);    return h;  }}

希望本文所述對大家的javascript程序設計有所幫助。

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 久久精品视频国产 | 国产激情网 | 娇妻被各种姿势c到高潮小说 | 精品国产一区二区三区天美传媒 | 亚洲精品久久久久久久久久久 | 久草视频福利在线观看 | 久久精品中文字幕一区二区三区 | 国产一级伦理片 | 国产中出视频 | 国产精品成人久久久久a级 av电影在线免费 | 国产一区二区三区高清 | 欧美日本国产精品 | 深夜福利视频免费观看 | 视频一区国产精品 | 少妇一级淫片高潮流水电影 | 91中文在线| 成人福利视频在线 | 超碰97最新 | 久久综合艹 | jizzzxxxxhd| 四季久久免费一区二区三区四区 | 青草av.久久免费一区 | 亚洲免费视 | 精品亚洲va在线va天堂资源站 | 中文字幕在线观看视频一区 | 97zyz成人免费视频 | 九九热视频这里只有精品 | 久久久久久亚洲综合影院红桃 | 成人福利视频在线观看 | 91av国产在线| 亚洲午夜网站 | 国产三级a三级三级 | 久久精品在线免费观看 | 日本高清在线免费 | 91福利在线观看 | 欧美一级毛片免费观看视频 | 亚洲国产超高清a毛毛片 | 国产成人综合在线观看 | 视频一区二区中文字幕 | 91久久极品少妇韩国 | 免费视频a |