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

📄 fw_menu.js

📁 JAVA中的fireworks4_anli的建立
💻 JS
📖 第 1 页 / 共 2 页
字号:
/** * fw_menu 24OCT2000 Version 4.0 * John Ahlquist, October 2000 * Copyright (c) 2000 Macromedia, Inc. * * based on menu.js * by gary smith, July 1997 * Copyright (c) 1997-1999 Netscape Communications Corp. * * Netscape grants you a royalty free license to use or modify this * software provided that this copyright notice appears on all copies. * This software is provided "AS IS," without a warranty of any kind. */function Menu(label, mw, mh, fnt, fs, fclr, fhclr, bg, bgh) {	this.version = "990702 [Menu; menu.js]";	this.type = "Menu";	this.menuWidth = mw;	this.menuItemHeight = mh;	this.fontSize = fs||12;	this.fontWeight = "plain";	this.fontFamily = fnt||"arial,helvetica,verdana,sans-serif";	this.fontColor = fclr||"#000000";	this.fontColorHilite = fhclr||"#ffffff";	this.bgColor = "#555555";	this.menuBorder = 1;	this.menuItemBorder = 1;	this.menuItemBgColor = bg||"#cccccc";	this.menuLiteBgColor = "#ffffff";	this.menuBorderBgColor = "#777777";	this.menuHiliteBgColor = bgh||"#000084";	this.menuContainerBgColor = "#cccccc";	this.childMenuIcon = "arrows.gif";	this.items = new Array();	this.actions = new Array();	this.childMenus = new Array();	this.hideOnMouseOut = true;	this.addMenuItem = addMenuItem;	this.addMenuSeparator = addMenuSeparator;	this.writeMenus = writeMenus;	this.FW_showMenu = FW_showMenu;	this.onMenuItemOver = onMenuItemOver;	this.onMenuItemAction = onMenuItemAction;	this.hideMenu = hideMenu;	this.hideChildMenu = hideChildMenu;	if (!window.menus) window.menus = new Array();	this.label = label || "menuLabel" + window.menus.length;	window.menus[this.label] = this;	window.menus[window.menus.length] = this;	if (!window.activeMenus) window.activeMenus = new Array();}function addMenuItem(label, action) {	this.items[this.items.length] = label;	this.actions[this.actions.length] = action;}function addMenuSeparator() {	this.items[this.items.length] = "separator";	this.actions[this.actions.length] = "";	this.menuItemBorder = 0;}// For NS6. function FIND(item) {	if (document.all) return(document.all[item]);	if (document.getElementById) return(document.getElementById(item));	return(false);}function writeMenus(container) {	if (window.triedToWriteMenus) return;	if (!container && document.layers) {		window.delayWriteMenus = this.writeMenus;		var timer = setTimeout('delayWriteMenus()', 250);		container = new Layer(100);		clearTimeout(timer);	} else if (document.all || document.hasChildNodes) {		document.writeln('<SPAN ID="menuContainer"></SPAN>');		container = FIND("menuContainer");	}	window.fwHideMenuTimer = null;	if (!container) return;		window.triedToWriteMenus = true; 	container.isContainer = true;	container.menus = new Array();	for (var i=0; i<window.menus.length; i++) 		container.menus[i] = window.menus[i];	window.menus.length = 0;	var countMenus = 0;	var countItems = 0;	var top = 0;	var content = '';	var lrs = false;	var theStat = "";	var tsc = 0;	if (document.layers) lrs = true;	for (var i=0; i<container.menus.length; i++, countMenus++) {		var menu = container.menus[i];		if (menu.bgImageUp) {			menu.menuBorder = 0;			menu.menuItemBorder = 0;		}		if (lrs) {			var menuLayer = new Layer(100, container);			var lite = new Layer(100, menuLayer);			lite.top = menu.menuBorder;			lite.left = menu.menuBorder;			var body = new Layer(100, lite);			body.top = menu.menuBorder;			body.left = menu.menuBorder;		} else {			content += ''+			'<DIV ID="menuLayer'+ countMenus +'" STYLE="position:absolute;z-index:1;left:10;top:'+ (i * 100) +';visibility:hidden;">\n'+			'  <DIV ID="menuLite'+ countMenus +'" STYLE="position:absolute;z-index:1;left:'+ menu.menuBorder +';top:'+ menu.menuBorder +';visibility:hide;" onMouseOut="mouseoutMenu();">\n'+			'	 <DIV ID="menuFg'+ countMenus +'" STYLE="position:absolute;left:'+ menu.menuBorder +';top:'+ menu.menuBorder +';visibility:hide;">\n'+			'';		}		var x=i;		for (var i=0; i<menu.items.length; i++) {			var item = menu.items[i];			var childMenu = false;			var defaultHeight = menu.fontSize+6;			var defaultIndent = menu.fontSize;			if (item.label) {				item = item.label;				childMenu = true;			}			menu.menuItemHeight = menu.menuItemHeight || defaultHeight;			menu.menuItemIndent = menu.menuItemIndent || defaultIndent;			var itemProps = 'font-family:' + menu.fontFamily +';font-weight:' + menu.fontWeight + ';fontSize:' + menu.fontSize + ';';			if (menu.fontStyle) itemProps += 'font-style:' + menu.fontStyle + ';';			if (document.all) 				itemProps += 'font-size:' + menu.fontSize + ';" onMouseOver="onMenuItemOver(null,this);" onClick="onMenuItemAction(null,this);';			else if (!document.layers) {				itemProps += 'font-size:' + menu.fontSize + 'px;'; // zilla wants 12px.			}			var l;			if (lrs) {				l = new Layer(800,body);			}			var dTag	= '<DIV ID="menuItem'+ countItems +'" STYLE="position:absolute;left:0;top:'+ (i * menu.menuItemHeight) +';'+ itemProps +'">';			var dClose = '</DIV>'			if (menu.bgImageUp) {				menu.menuBorder = 0;				menu.menuItemBorder = 0;				dTag	= '<DIV ID="menuItem'+ countItems +'" STYLE="background:url('+menu.bgImageUp+');position:absolute;left:0;top:'+ (i * menu.menuItemHeight) +';'+ itemProps +'">';				if (document.layers) {					dTag = '<LAYER BACKGROUND="'+menu.bgImageUp+'" ID="menuItem'+ countItems +'" TOP="'+ (i * menu.menuItemHeight) +'" style="' + itemProps +'">';					dClose = '</LAYER>';				}			}			var textProps = 'position:absolute;left:' + menu.menuItemIndent + ';top:1;';			if (lrs) {				textProps +=itemProps;				dTag = "";				dClose = "";			}			var dText	= '<DIV ID="menuItemText'+ countItems +'" STYLE="' + textProps + 'color:'+ menu.fontColor +';">'+ item +'&nbsp</DIV>\n<DIV ID="menuItemHilite'+ countItems +'" STYLE="' + textProps + 'top:1;color:'+ menu.fontColorHilite +';visibility:hidden;">'+ item +'&nbsp</DIV>';			if (item == "separator") {				content += ( dTag + '<DIV ID="menuSeparator'+ countItems +'" STYLE="position:absolute;left:1;top:2;"></DIV>\n<DIV ID="menuSeparatorLite'+ countItems +'" STYLE="position:absolute;left:1;top:2;"></DIV>\n' + dClose);			} else if (childMenu) {				content += ( dTag + dText + '<DIV ID="childMenu'+ countItems +'" STYLE="position:absolute;left:0;top:3;"><IMG SRC="'+ menu.childMenuIcon +'"></DIV>\n' + dClose);			} else {				content += ( dTag + dText + dClose);			}			if (lrs) {				l.document.open("text/html");				l.document.writeln(content);				l.document.close();					content = '';				theStat += "-";				tsc++;				if (tsc > 50) {					tsc = 0;					theStat = "";				}				status = theStat;			}			countItems++;  		}		if (lrs) {			// focus layer			var focusItem = new Layer(100, body);			focusItem.visiblity="hidden";			focusItem.document.open("text/html");			focusItem.document.writeln("&nbsp;");			focusItem.document.close();			} else {		  content += '	  <DIV ID="focusItem'+ countMenus +'" STYLE="position:absolute;left:0;top:0;visibility:hide;" onClick="onMenuItemAction(null,this);">&nbsp;</DIV>\n';		  content += '   </DIV>\n  </DIV>\n</DIV>\n';		}		i=x;	}	if (document.layers) {				container.clip.width = window.innerWidth;		container.clip.height = window.innerHeight;		container.onmouseout = mouseoutMenu;		container.menuContainerBgColor = this.menuContainerBgColor;		for (var i=0; i<container.document.layers.length; i++) {			proto = container.menus[i];			var menu = container.document.layers[i];			container.menus[i].menuLayer = menu;			container.menus[i].menuLayer.Menu = container.menus[i];			container.menus[i].menuLayer.Menu.container = container;			var body = menu.document.layers[0].document.layers[0];			body.clip.width = proto.menuWidth || body.clip.width;			body.clip.height = proto.menuHeight || body.clip.height;			for (var n=0; n<body.document.layers.length-1; n++) {				var l = body.document.layers[n];				l.Menu = container.menus[i];				l.menuHiliteBgColor = proto.menuHiliteBgColor;				l.document.bgColor = proto.menuItemBgColor;				l.saveColor = proto.menuItemBgColor;				l.onmouseover = proto.onMenuItemOver;				l.onclick = proto.onMenuItemAction;				l.action = container.menus[i].actions[n];				l.focusItem = body.document.layers[body.document.layers.length-1];				l.clip.width = proto.menuWidth || body.clip.width + proto.menuItemIndent;				l.clip.height = proto.menuItemHeight || l.clip.height;				if (n>0) l.top = body.document.layers[n-1].top + body.document.layers[n-1].clip.height + proto.menuItemBorder;				l.hilite = l.document.layers[1];				if (proto.bgImageUp) l.background.src = proto.bgImageUp;				l.document.layers[1].isHilite = true;				if (l.document.layers[0].id.indexOf("menuSeparator") != -1) {					l.hilite = null;					l.clip.height -= l.clip.height / 2;					l.document.layers[0].document.bgColor = proto.bgColor;					l.document.layers[0].clip.width = l.clip.width -2;					l.document.layers[0].clip.height = 1;					l.document.layers[1].document.bgColor = proto.menuLiteBgColor;					l.document.layers[1].clip.width = l.clip.width -2;					l.document.layers[1].clip.height = 1;					l.document.layers[1].top = l.document.layers[0].top + 1;				} else if (l.document.layers.length > 2) {					l.childMenu = container.menus[i].items[n].menuLayer;					l.document.layers[2].left = l.clip.width -13;					l.document.layers[2].top = (l.clip.height / 2) -4;					l.document.layers[2].clip.left += 3;					l.Menu.childMenus[l.Menu.childMenus.length] = l.childMenu;				}			}			body.document.bgColor = proto.bgColor;			body.clip.width  = l.clip.width +proto.menuBorder;			body.clip.height = l.top + l.clip.height +proto.menuBorder;			var focusItem = body.document.layers[n];			focusItem.clip.width = body.clip.width;			focusItem.Menu = l.Menu;			focusItem.top = -30;            focusItem.captureEvents(Event.MOUSEDOWN);            focusItem.onmousedown = onMenuItemDown;			menu.document.bgColor = proto.menuBorderBgColor;			var lite = menu.document.layers[0];			lite.document.bgColor = proto.menuLiteBgColor;			lite.clip.width = body.clip.width +1;			lite.clip.height = body.clip.height +1;			menu.clip.width = body.clip.width + (proto.menuBorder * 3) ;			menu.clip.height = body.clip.height + (proto.menuBorder * 3);		}	} else {		if ((!document.all) && (container.hasChildNodes)) {			container.innerHTML=content;		} else {			container.document.open("text/html");			container.document.writeln(content);			container.document.close();			}		if (!FIND("menuLayer0")) return;		var menuCount = 0;		for (var x=0; x<container.menus.length; x++) {			var menuLayer = FIND("menuLayer" + x);			container.menus[x].menuLayer = "menuLayer" + x;			menuLayer.Menu = container.menus[x];			menuLayer.Menu.container = "menuLayer" + x;			menuLayer.style.zIndex = 1;		    var s = menuLayer.style;			s.top = s.pixelTop = -300;			s.left = s.pixelLeft = -300;			var menu = container.menus[x];			menu.menuItemWidth = menu.menuWidth || menu.menuIEWidth || 140;			menuLayer.style.backgroundColor = menu.menuBorderBgColor;			var top = 0;			for (var i=0; i<container.menus[x].items.length; i++) {				var l = FIND("menuItem" + menuCount);				l.Menu = container.menus[x];				if (l.addEventListener) { // ns6					l.style.width = menu.menuItemWidth;						l.style.height = menu.menuItemHeight;					l.style.top = top;					l.addEventListener("mouseover", onMenuItemOver, false);					l.addEventListener("click", onMenuItemAction, false);					l.addEventListener("mouseout", mouseoutMenu, false);				} else { //ie					l.style.pixelWidth = menu.menuItemWidth;						l.style.pixelHeight = menu.menuItemHeight;					l.style.pixelTop = top;				}				top = top + menu.menuItemHeight+menu.menuItemBorder;				l.style.fontSize = menu.fontSize;				l.style.backgroundColor = menu.menuItemBgColor;				l.style.visibility = "inherit";				l.saveColor = menu.menuItemBgColor;				l.menuHiliteBgColor = menu.menuHiliteBgColor;				l.action = container.menus[x].actions[i];				l.hilite = FIND("menuItemHilite" + menuCount);				l.focusItem = FIND("focusItem" + x);				l.focusItem.style.pixelTop = l.focusItem.style.top = -30;				var childItem = FIND("childMenu" + menuCount);				if (childItem) {					l.childMenu = container.menus[x].items[i].menuLayer;					childItem.style.pixelLeft = childItem.style.left = menu.menuItemWidth -11;					childItem.style.pixelTop = childItem.style.top =(menu.menuItemHeight /2) -4;					//childItem.style.pixelWidth = 30 || 7;					//childItem.style.clip = "rect(0 7 7 3)";					l.Menu.childMenus[l.Menu.childMenus.length] = l.childMenu;				}				var sep = FIND("menuSeparator" + menuCount);				if (sep) {					sep.style.clip = "rect(0 " + (menu.menuItemWidth - 3) + " 1 0)";					sep.style.width = sep.style.pixelWidth = menu.menuItemWidth;						sep.style.backgroundColor = menu.bgColor;					sep = FIND("menuSeparatorLite" + menuCount);					sep.style.clip = "rect(1 " + (menu.menuItemWidth - 3) + " 2 0)";					sep.style.width = sep.style.pixelWidth = menu.menuItemWidth;						sep.style.backgroundColor = menu.menuLiteBgColor;					l.style.height = l.style.pixelHeight = menu.menuItemHeight/2;					l.isSeparator = true					top -= (menu.menuItemHeight - l.style.pixelHeight)				} else {					l.style.cursor = "hand"				}				menuCount++;			}			menu.menuHeight = top-1;

⌨️ 快捷键说明

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