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

📄 menu.js

📁 Lirong网络办公系统
💻 JS
字号:

function IEVer2()
{
var str=navigator.appVersion
var loca=str.indexOf('MSIE') +5
return parseInt(str.substr(loca))

}
//Size of  buttons.
var BTN_HEIGHT = 22;

//Space between buttons.
var BTN_SPACE = 0;

var ITM_HEIGHT = 25;

var ITM_SPACE = 0;

var ButtonCount = 0;
var ItemCounts;
var FocusButton;
var wstyle
if(IEVer2()>=6)
{
wstyle="filter:alpha(opacity=80); "
}
;else
{
wstyle=""
}

var org
org=1


function linkto(url)
{
window.open(url,"main","");
return false;
}
//reset postion of buttons and items, show clicked button's items, hide other items.
function onBtnClick(btnIndex)
{
	var i;
	var minHeight;
	var btmBtnTop;
	if ((btn < 0) || (btn >= ButtonCount)) return;
	document.body.scrollTop = 0;
	for(i=0; i<=btnIndex; i++)
	{
		var btn = document.all.item("BTN" + i);
		if (btn == null) 
			alert("NULL BTN");
		else
			btn.style.posTop = i * (BTN_HEIGHT + BTN_SPACE) ;
	};
	//minimun height used by buttons and items.
	minHeight = ButtonCount * (BTN_HEIGHT + BTN_SPACE) - BTN_SPACE + ItemCounts[btnIndex] * (ITM_HEIGHT + ITM_SPACE);
	//calculate bottom button's start top position.
	if (minHeight > document.body.clientHeight)
	{
		document.body.setAttribute("SCROLL", "yes", false);
		window.parent.mm.cols="160+16,*"
		btmBtnTop = (btnIndex+1) * (BTN_HEIGHT + BTN_SPACE) - BTN_SPACE + ItemCounts[btnIndex] * (ITM_HEIGHT + ITM_SPACE);
	}
	else
	{
		document.body.setAttribute("SCROLL", "no", false);
		window.parent.mm.cols="160,*"
		btmBtnTop = document.body.clientHeight - (ButtonCount - btnIndex -1) * (BTN_HEIGHT + BTN_SPACE);
	}
	for(i=btnIndex + 1; i<ButtonCount; i++)
	{
		var btn = document.all.item("BTN" + i);
		if (btn == null) 
			alert("NULL BTN");
		else
			btn.style.posTop = btmBtnTop ;
		btmBtnTop += (BTN_HEIGHT + BTN_SPACE);
	};
	var baseHeight=0;
	var itmtop = (BTN_HEIGHT + BTN_SPACE) * (btnIndex + 1);

	for(i=0; i<ButtonCount; i++)
	{
		baseHeight=itmtop;
	
		for(j=0; j<ItemCounts[i]; j++)
		{
			var tbl = document.all.item("ITM" + i + "_" + j);
			if (null == tbl) continue;
			if (i == btnIndex)
			{
				
				tbl.style.posTop =baseHeight-1 ;//+tbl.Height  j * (ITM_HEIGHT + ITM_SPACE)-2
				baseHeight=baseHeight+tbl.style.posHeight//ITM_HEIGHT;

				tbl.style.visibility = "visible";
			}
			else
				tbl.style.visibility = "hidden";
		}}
	FocusButton = btnIndex;
};

function onResize()
{
	onBtnClick(FocusButton);
}

function ovv(a)
{
a.bgColor= color1;
a.style.border="none" 

}

function moo(a)
{
 a.bgColor= color2;
 a.style.border="1px  solid " + colorborder

}

function ov1(a)
{

a.style.border="none" 

}

function mo1(a)
{

 a.style.border="1px  solid " + "#ffffff"

}

function hot(a)
{

 a.style.border="1px  solid ffffff"

}



function constructmenu()
{
	var i,j;
	var str;
	str = "";

	color1=mytree.getAttribute("color1")
	color2=mytree.getAttribute("color2")
	colorborder=mytree.getAttribute("colorborder")
	img1=mytree.getAttribute("img1")
	haveico=mytree.getAttribute("haveico")

	if(mytree.getAttribute("org")!=null)org=parseInt(mytree.getAttribute("org"))

		if(haveico=='yes') ITM_HEIGHT=ITM_HEIGHT+35;
	
	ItemCounts = new Array();
	for(i=0;i<mytree.children.length; i++)
	{
		var item = mytree.children.item(i);
		
		str += '<div '+
			'ID="BTN' + i + '" ' +
			'STYLE="cursor: arrow;background-image: url(' +img1+'); position:absolute;left:18; HEIGHT: ' +BTN_HEIGHT + 'px; WIDTH: 120;" ' +
			'   onMousedown ="onBtnClick(' + i +'); ' +
			'" ><table  width="100%" border="0" cellspacing="0" cellpadding="0" height="100%"><tr><td align="left" style="cursor:default " onMouseover="mo1(this)" onMouseup="mo1(this)" onMouseout="ov1(this)"> '+ item.getAttribute("VALUE") + '</td></tr></table></div>';
		str += '\n<BR>';
		
		ItemCounts[i] = 0;
		
		
		/*var item = mytree.children.item(i);
		str += '<input type=button '+
			'ID="BTN' + i + '" '+
			'class=vinputbutton  VALUE="' + item.getAttribute("VALUE") +'" ' +
			'STYLE="position:absolute;background:buttonface; HEIGHT: ' +BTN_HEIGHT + 'px; WIDTH: 100%;" ' +
			'   ONCLICK="onBtnClick(' + i +'); ' +
			'">';
		str += '\n<BR>';
		ItemCounts[i] = 0;
		
			*/
	//	包含图片代码
	if(haveico=='yes'){
		for(j=0; j < item.children.length; j++)
		{	url=item.children.item(j).getAttribute("HREF")			
			str += '<TABLE algin=center class=vtext border=0 bggcolor=#<%=Session("vtablebordercolor")%> cellspace=1 cellpad=1 WIDTH=100% ID="ITM' + i + '_' + j + '" STYLE="position:absolute;left:24">';
		    str += '<A HREF="../'+url+'" target="main">';
			str += '<TR nowrap style="border:none;cursor: hand" height='+ ITM_HEIGHT +'  onMouseOver=this.style.background="' + color2 +'" onMouseOut=this.style.background="' + color1 +'"  ><TD nowrap ALIGN=center>';
			
			str += '&nbsp;<A HREF="../'+url+'" target="main"><IMG SRC="' + item.children.item(j).getAttribute("IMGSRC") + '" width="32" height="32" alihgn="absmiddle" border=0 style="cursor: hand;background:none;border:none"  ><br>';
			str += '' + item.children.item(j).getAttribute("VALUE");
			str += '</TD></TR></a>';
			str += '</TABLE>';
			ItemCounts[i] ++;
		}
	};
	else
	{

		for(j=0; j < item.children.length; j++)
		{	url=item.children.item(j).getAttribute("HREF");
			ivalue=item.children.item(j).getAttribute("VALUE");
			if(ivalue=='-')
			{
			str += '<TABLE algin=center    border=0 cellspace=1 cellpad=1    WIDTH=110 ID="ITM' + i + '_' + j + '" STYLE="' + wstyle + ' position:absolute;cursor: arrow;left:23;height:10"><TR  valign=top><TD bgcolor=' + color1 + ' ><hr size=1></TD></TR></TABLE>';
			}else	
			{		
			str += '<TABLE algin=center  border=0 cellspace=1 cellpad=1 WIDTH=110 ID="ITM' + i + '_' + j + '" STYLE="' + wstyle + ' position:absolute;cursor: arrow;left:23;height: '+ ITM_HEIGHT +'">';
		    str += '<A HREF="../'+url+'" target="main">';
			str += '<TR nowrap style="border:none;cursor: hand" height='+ ITM_HEIGHT +'><TD nowrap bgcolor=' + color1 + '  onMouseOver=moo(this) onMouseOut=ovv(this) ALIGN=left>';
			str += '&nbsp;<img src="../images/button.gif">&nbsp;' + ivalue;
			str += '</TD></TR></a>';
			str += '</TABLE>';
			}
			ItemCounts[i] ++;
		}
	}
		ButtonCount ++;
	}	
	menu.outerHTML = str;
	onBtnClick(org);
	//menu.innerText = str;	
	FocusButton =org;
	window.onresize = onResize;

}

⌨️ 快捷键说明

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