⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 menu.js

📁 物业管理和办公自动化系统
💻 JS
📖 第 1 页 / 共 3 页
字号:
	// 显示对象
	var objArray = document.all.tags(elmID);
	var obj;
	for (var j=0; j<objArray.length; j++)
	{
		obj = objArray(j);
		obj.style.visibility = "visible";
	}

	// 显示 IFRAME 中的对象
	objArray = document.all.tags("IFRAME");
	for (var j=0; j<objArray.length; j++)
	{ 
		var objArrayInnerFrame = document.frames(j).document.all.tags(elmID);
		for (var k=0; k<objArrayInnerFrame.length; k++)
		{
			obj = objArrayInnerFrame(k);
			obj.style.visibility = "visible";
		}
	}
}

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.visibility='hidden';
	misShow=false;

	ShowElement("SELECT");
}

function msubmenuhide(menuid)
{
	menuid.style.visibility='hidden';
}

function mmenushow(menuid,pid)
{
	// 如果没有子菜单,则不显示子菜单
	// 没有子菜单时menuid.offsetHeight = 1,这里用5来比较,如果小于5,则认为没有子菜单
	// 如果不加这一句,会出现子菜单的一条上边线
	if (menuid.offsetHeight < 5)	
		return;

	menuid.style.left=mposflag.offsetLeft+pid.offsetLeft+mmenuadjust;
	menuid.style.top=mposflag.offsetTop+mmenutable.offsetHeight+mmenuadjustV-1;
	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';
	misShow=true;

	HideElement(menuid, "SELECT");
}


function mshowsubmenu(menuid,pid,rid)
{
	menuid.style.left=pid.offsetWidth+rid.offsetLeft - 1;
	menuid.style.top=pid.offsetTop+rid.offsetTop;
	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';

	HideElement(menuid, "SELECT");
}

function mmenu_over(menuid,x)
{
	toel = getReal(window.event.toElement, "className", "coolButton");
	fromel = getReal(window.event.fromElement, "className", "coolButton");
	if (toel == fromel) return;
	if(!misShow)
	{
		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)
{
	// 这里只有“我回来了”才是打开target="_blank"窗口的菜单
	var cmd;
	if(eval("msub"+j).items[i].target=="blank")
	{
		cmd = "window.open('"+eval("msub"+j).items[i].command+"','','width=350,height=124,top=300,left=300')";
	}
	else
	{
		cmd = eval("msub"+j).items[i].target+".location=\""+eval("msub"+j).items[i].command+"\"";
	}
	eval(cmd);
}

function mexec2(x)
{
	// 这里只有“我回来了”才是打开target="_blank"窗口的菜单
	var cmd;
	if(mmenus[x].target=="blank")
	{
	  cmd = "window.open('"+mmenus[x].command+"','','width=350,height=124,top=300,left=300')";
	}
	else
	{
		cmd = mmenus[x].target+".location=\""+mmenus[x].command+"\"";
	}
	eval(cmd);
}

function mexec(x,i)
{
	// 这里只有“我回来了”才是打开target="_blank"窗口的菜单
	var cmd;
	if(mmenus[x].items[i].target=="blank")
	{
		cmd = "window.open('"+mmenus[x].items[i].command+"','','width=350,height=124,top=300,left=300')";
	}
	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;

function mwritetodocument()
{
	var mwb=0;
	var stringx='<div id="mposflag" style="position:absolute;"></div><table id=mmenutable border=0 cellpadding=0 cellspacing=0 width='+mmenuwidth+' height='+mmenuheight+' background='+mmenubg+
                     ' onselectstart="event.returnValue=false"'+
                     ' style="cursor:'+mcursor+';'+mfonts+
                     ' border-left: '+mwb+'px solid '+mmenuoutbordercolor+';'+
                     ' border-right: '+mwb+'px solid '+mmenuinbordercolor+'; '+
                     ' border-top: '+mwb+'px solid '+mmenuoutbordercolor+'; '+
                     ' border-bottom: '+mwb+'px solid '+mmenuinbordercolor+'; padding:0px;"><tr>'

	stringx += "<td width=110 style='cursor:default'>&nbsp;</td>"
	for(var x=0;x<mmenus.length;x++)
	{
		var thismenu=mmenus[x];
		var imgsize="";
		if(thismenu.sizex!="0"||thismenu.sizey!="0")	
			imgsize=" width="+thismenu.sizex+" height="+thismenu.sizey;
		var ifspace="";
		if(thismenu.caption!="")
			ifspace="&nbsp;";
		stringx += "<td nowrap class=coolButton id=mMenu"+x+" style='border: "+mitemedge+"px solid;"+mmenucolor+
                     	"' width="+mmenuunitwidth+"px onmouseover=mmenu_over(mmenudiv"+x+
                     	//"' onmouseover=mmenu_over(mmenudiv"+x+
                     	","+x+") onmouseout=mmenu_out("+x+
                     	") onmousedown=mmenu_down(mmenudiv"+x+","+x+")";
		if(thismenu.command!="")
		{
			stringx += " onmouseup=mmenu_up();mexec2("+x+");";
		}
		else
		{

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -