当前位置: 首页 > 图文教程 > 网页制作 > HTML/XHTML教程 > 一个简单的javascript菜单(4)

HTML/XHTML教程
CSS和HTML与前端技术层图示
关于超链接的一些问题
网页设计制作之改进超级链接效果
HTML 5 预览
HTML是WEB标准开发的中心基础
HTML5的结构和语义(3):语义性的块级元素
被遗忘掉的button标签
CSS标准:vertical-align属性
网页表格分割线去除方法
网页表格表框制作技巧
HTML教程:定义列表
HTML5: Web 标准最巨大的飞跃
ul列表标记设计网页多列布局
HTML其实就是学习几个重要标记的应用
链接A的语义、写法和最佳实践
HTML网页的段落排版和换行
HTML网页各种字体格式的细节修饰
网页HTML代码:滚动文字的制作
HTML代码实例:详细讲解超级链接
html标签:sub标记和sup标记

HTML/XHTML教程 中的 一个简单的javascript菜单(4)


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-11-04   浏览: 62 ::
收藏到网摘: n/a


  //菜单条的按钮
  this.addMenuBarItem=function(ary,index){
   var item=menu.crtElement("button",menu.bar);
   item.value=ary[0];
   item.disabled=!ary;
   item.className=id+"_barItem";
   item.onmouseover=function(){
    if(menu.selectedIndex==-1){
     item.className=id+"_barItemHover";
    }
    else{
     menu.barItems[selectedIndex].className=id+"_barItem";
     item.className=id+"_barItemDown";
     menu.showMenu(index);
    }
    window.status=ary;
   }
   item.onmouseout=function(){
    if(menu.selectedIndex==-1)  item.className=id+"_barItem";
    window.status="";
   }
   item.onclick=function(){
    event.cancelBubble=true;
    if(menu.selectedIndex==-1){
     item.className=id+"_barItemDown";
     menu.showMenu(index);
    }
    else{
     menu.hideMenu();
     item.className=id+"_barItemHover";
    }
    menu.execute(ary);
    item.blur();
   }
   return item;
  }

  //显示子菜单
  this.showMenu=function(index){
   if(menu.selectedIndex!=-1) menu.pads[selectedIndex].style.display="none";
   menu.board.style.pixelLeft=menu.barItems[index].offsetLeft+2;
   //menu.board.style.pixelHeight="";
   if(menu.pads[index].rows.length>0) menu.board.style.display="";
   else menu.board.style.display="none";
   menu.pads[index].style.display="";
   menu.selectedIndex=index;
  }