下拉透明菜单二

function mMenu(caption,command,target,img,sizex,sizey,pos){
 this.items = new Array();
 this.caption=caption;
 this.command=command;
 this.target=target;
 this.img=img;
 this.sizex=sizex;
 this.sizey=sizey;
 this.pos=pos;
 this.id=mMenuRegister(this);
}
function mMenuAddItem(item)
{
  this.items[this.items.length] = item
  item.parent = this.id;
  this.children=true;
}

mMenu.prototype.addItem = mMenuAddItem;
mMenuItem.prototype.addsubItem = mMenuAddItem;

function mtoout(src){

src.style.borderLeftColor=mmenuoutbordercolor;
src.style.borderRightColor=mmenuinbordercolor;
src.style.borderTopColor=mmenuoutbordercolor;
src.style.borderBottomColor=mmenuinbordercolor;
src.style.backgroundColor=mmenuoutcolor;
src.style.color=mmenuovercolor;
}
function mtoin(src){

src.style.borderLeftColor=mmenuinbordercolor;
src.style.borderRightColor=mmenuoutbordercolor;
src.style.borderTopColor=mmenuinbordercolor;
src.style.borderBottomColor=mmenuoutbordercolor;
src.style.backgroundColor=mmenuincolor;
src.style.color=mmenuovercolor;
}
function mnochange(src){
src.style.borderLeftColor=mmenucolor;
src.style.borderRightColor=mmenucolor;
src.style.borderTopColor=mmenucolor;
src.style.borderBottomColor=mmenucolor;
src.style.backgroundColor='';
src.style.color=mfontcolor;

}
function mallhide(){
 for(var nummenu=0;nummenu<mmenus.length;nummenu++){
  var themenu=document.all['mMenu'+nummenu]
  var themenudiv=document.all['mmenudiv'+nummenu]
                mnochange(themenu);
                mmenuhide(themenudiv);
                }
        for(nummenu=1;nummenu<=mnumberofsub;nummenu++){ 
         var thesub=document.all['msubmenudiv'+nummenu]     
         msubmenuhide(thesub);
         mnochange(document.all['mp'+nummenu]);
         document.all["mitem"+nummenu].style.color=mfontcolor;
         }
}
function mmenuhide(menuid){
menuid.style.filter='Alpha(Opacity=100)';
hideSwipe(menuid);
misShow=false;
}
function msubmenuhide(menuid){
menuid.style.filter='Alpha(Opacity=100)';
menuid.style.visibility='hidden';
}
function mmenushow(menuid,pid){
menuid.style.filter='Alpha(Opacity=80)';
menuid.style.left=mposflag.offsetLeft+pid.offsetLeft+mmenuadjust;menuid.style.top=mposflag.offsetTop+mmenutable.offsetHeight+mmenuadjustV;
if(mmenuitemwidth+parseInt(menuid.style.left)>document.body.clientWidth+document.body.scrollLeft)
menuid.style.left=document.body.clientWidth+document.body.scrollLeft-mmenuitemwidth;
mtmpleft=menuid.style.left;mtmptop=menuid.style.top;swipe(menuid,2,4);
misShow=true;
}
function mshowsubmenu(menuid,pid,rid){
menuid.style.filter='Alpha(Opacity=80)';
menuid.style.left=pid.offsetWidth+rid.offsetLeft;
menuid.style.top=pid.offsetTop+rid.offsetTop-3;
if(mmenuitemwidth+parseInt(menuid.style.left)>document.body.clientWidth+document.body.scrollLeft)
menuid.style.left=document.body.clientWidth+document.body.scrollLeft-mmenuitemwidth;
menuid.style.visibility='visible';
}
function mmenu_over(menuid,x){
toel = getReal(window.event.toElement, "className", "coolButton");
fromel = getReal(window.event.fromElement, "className", "coolButton");
if (toel == fromel) return;
if(x<0){
  misShow = false;
  mallhide();
  mtoout(eval("mMenu"+x));
}else{

  mallhide();
  mtoin(eval("mMenu"+x));
  mmenushow(menuid,eval("mMenu"+x));

}
clearTimeout(mpopTimer);
}
function mmenu_out(x){
toel = getReal(window.event.toElement, "className", "coolButton");
fromel = getReal(window.event.fromElement, "className", "coolButton");
if (toel == fromel) return;
if (misShow){
mtoin(eval("mMenu"+x));
}else{
mnochange(eval("mMenu"+x));
}
mpopOut()
}
function mmenu_down(menuid,x){
  if(misShow){
  mmenuhide(menuid);
  mtoout(eval("mMenu"+x));
  }
  else{
  mtoin(eval("mMenu"+x));
  mmenushow(menuid,eval("mMenu"+x));
  misdown=true;
  }
}
function mmenu_up(){
  misdown=false;
}
function mmenuitem_over(menuid,item,x,j,i){
toel = getReal(window.event.toElement, "className", "coolButton");
fromel = getReal(window.event.fromElement, "className", "coolButton");
if (toel == fromel) return;
srcel = getReal(window.event.srcElement, "className", "coolButton");
        for(nummenu=1;nummenu<=mnumberofsub;nummenu++){ 
         var thesub=document.all['msubmenudiv'+nummenu]
         if(!(menuid==thesub||menuid.style.tag>=thesub.style.tag)){
         msubmenuhide(thesub);
         mnochange(document.all['mp'+nummenu]);
         document.all["mitem"+nummenu].style.color=mfontcolor;
         }
        }
if(item)document.all["mitem"+item].style.color=mmenuovercolor;
if(misdown||item){
 mtoin(srcel);
}
else{
 mtoout(srcel);
}
if(x==-1)mthestatus=eval("msub"+j).items[i].statustxt;
if(j==-1)mthestatus=mmenus[x].items[i].statustxt;
if(mthestatus!=""){
 musestatus=true;
 window.status=mthestatus;
}
clearTimeout(mpopTimer);
}
function mmenuitem_out(hassub){
toel = getReal(window.event.toElement, "className", "coolButton");
fromel = getReal(window.event.fromElement, "className", "coolButton");
if (toel == fromel) return;
srcel = getReal(window.event.srcElement, "className", "coolButton");
if(!hassub)mnochange(srcel);
if(musestatus)window.status="";
mpopOut()
}
function mmenuitem_down(){
srcel = getReal(window.event.srcElement, "className", "coolButton");
mtoin(srcel)
misdown=true;
}
function mmenuitem_up(){
srcel = getReal(window.event.srcElement, "className", "coolButton");
mtoout(srcel)
misdown=false;
}
function mexec3(j,i){
var cmd;
if(eval("msub"+j).items[i].target=="blank"){
  cmd = "window.open('"+eval("msub"+j).items[i].command+"')";
}else{
  cmd = eval("msub"+j).items[i].target+".location=\""+eval("msub"+j).items[i].command+"\"";
}
eval(cmd);
}
function mexec2(x){
var cmd;
if(mmenus[x].target=="blank"){
  cmd = "window.open('"+mmenus[x].command+"')";
}else{
  cmd = mmenus[x].target+".location=\""+mmenus[x].command+"\"";
}
eval(cmd);
}
function mexec(x,i){
var cmd;
if(mmenus[x].items[i].target=="blank"){
  cmd = "window.open('"+mmenus[x].items[i].command+"')";
}else{
  cmd = mmenus[x].items[i].target+".location=\""+mmenus[x].items[i].command+"\"";
}
eval(cmd);
}
function mbody_click(){

if (misShow){
 srcel = getReal(window.event.srcElement, "className", "coolButton");
 for(var x=0;x<=mmenus.length;x++){
  if(srcel.id=="mMenu"+x)
  return;
 }
 for(x=1;x<=mnumberofsub;x++){
  if(srcel.id=="mp"+x)
  return;
 }
 mallhide();
}
}
document.onclick=mbody_click;

时间: 2024-09-28 14:45:57

下拉透明菜单二的相关文章

下拉透明菜单

菜单|透明|下拉 下拉透明菜单 <script language="JavaScript">var mmenus    = new Array();var misShow   = new Boolean(); misShow=false;var misdown   = new Boolean();misdown=false;var mnumberofsub=0;var musestatus=false;var mpopTimer = 0;mmenucolor='#89CB1

下拉透明菜单一部分

下拉透明菜单 <script language="JavaScript"> var mmenus    = new Array(); var misShow   = new Boolean(); misShow=false; var misdown   = new Boolean(); misdown=false; var mnumberofsub=0; var musestatus=false; var mpopTimer = 0; mmenucolor='#89CB10

JS特效代码--下拉透明菜单

 <script language="JavaScript"> var mmenus = new Array(); var misShow = new Boolean();  misShow=false; var misdown = new Boolean(); misdown=false; var mnumberofsub=0; var musestatus=false; var mpopTimer = 0; mmenucolor='#89CB10';mfontcolor

下拉透明菜单四

mpmenu1=new mMenu('网站首页','/','self','','','',''); mpmenu1.addItem(new mMenuItem(' 用户注册','/register.asp','self',false,'用户注册',null,'','','','')); mpmenu1.addItem(new mMenuItem(' 用户登录','/login.asp','self',false,'用户登录',null,'','','','')); mpmenu1.addItem

下拉透明菜单三

function mwritetodocument(){       var mwb=1;                      var stringx='<div id="mposflag" style="position:absolute;"></div><table  id=mmenutable border=0 cellpadding=3 cellspacing=2 width='+mmenuwidth+' height='

只用CSS做的下拉式菜单--A Drop-Down Menu With Only CSS

最近在网上发现了一个只用CSS实现的下拉式菜单(Drop-Down Menu),感觉很新鲜也很酷.于是仔细看了作者的介绍以及源代码,发现核心就是一个":hover"伪类的使用.在CSS1中此伪类仅可用于a对象.且 对于无href属性(特性)的a对象,此伪类不发生作用.在CSS2中此伪类可以应用于任何对象.但IE6及其以下版本都不能很好的支持CSS2,因此 IE6及其以下版本就不能很好的运行这个程序了.所幸Firefox,Netscape,Opera,Safari等浏览器的最新版本均能很

用好表单的下拉式菜单

菜单|下拉 用<select>标记可以在表单中方便地插入一个下拉式菜单,以方便用户进行选择,这在制作调查表或用户订单时非常有用,对这种下拉式菜单稍加改造则可以制作出名符其实的下拉式导航菜单. 一.下拉式选择框 这两个示例,外观形式有所不同,但都是用了<select>和<option>标记做出来的,只是设置了不同的参数而已.比较一下它们的源代码,就明白了: 左边的菜单源代码:<select name="select" size="4&q

基于javascript实现全国省市二级联动下拉选择菜单_javascript技巧

本文实例讲述了js实现全国省市二级联动下拉选择菜单,分享给大家供大家参考.具体如下: 效果图:   具体代码: <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312" /> <title>无标题文档</title> <script type="text/javascript"

Java Swing中的下拉式菜单(menu)、弹出式菜单(JPopupMenu)、选项卡窗体(JTabbedPane)组件使用案例_java

菜单是GUI中最常用的组件,菜单不是Component类的子类,不能放置在普通容器中,不受布局管理器的约束,只能放置在菜单栏中. 菜单组件由菜单栏 (MenuBar).菜单(Menu)和菜单项(MenuItem)三部分组成. 一个菜单栏由若干个菜单组成,一个菜单又由若干个菜单项组成.一般菜单栏放 Frame 窗口中,只要调用 Frame 类的 setMenuBar()方法即可. 常用的菜单有:下拉式菜单和弹出式菜单(独立显示,可出现在任意地方). 一:下拉式菜单的创建步骤: 1.创建一个菜单栏.