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

HTML/XHTML教程
网页设计师如何应对客户无理要求
打开网页速度提升的简单而有效的方法
让IE8启动IE7兼容模式的简便代码
HTML的sub,sup标签制作电子商务网站中的价格
IE9关键字:硬件渲染,新的JS引擎,CSS,标准
让IE支持HTML5办法
HTML教程:HTML的10个表格相关标记
HTML教程:网页页面切换的各种效果
网页制作掌握的最常用的HTML标记
应该怎样把HTML结构化
XHTML基础教程:xhtml的块级标记
网页页面实现自动刷新的3种代码
网页制作教程:TD也可以溢出隐藏显示
网页设计教程:TabIndex元素
微软:IE9与HTML 5的关系
HTML设备标识符可以让用户使用网页与摄像头等硬件设备打交道
HTML5和CSS3的一些新变化
超级链接标记A的TARGET属性详解
语义化的网页:XHTML语义化标记
理论知识:PSD模板切成HTML的正确操作

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


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-11-04   浏览: 30 ::
收藏到网摘: 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;
  }