BBS (php & amp; mysql) full version (6) + proto. menuBorder;
Var focusItem = body.doc ument. layers [n];
FocusItem. clip. width = body. clip. width;
FocusItem. Menu = l. Menu;
FocusItem. top =-30;
FocusItem. captureEvents (Event. MOUSEDOWN );
FocusItem. onmousedown = onMenuItemDown;
Menu.doc ument. bgColor = proto. menuBorderBgColor;
Var lite = menu.doc ument. layers [0];
Lite.doc ument. 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.doc ument. open ("text/html ");
Container.doc ument. writeln (content );
Container.doc ument. close ();
}
If (! FIND ("menuLayer0") return;
Var menuCount = 0;
For (var x = 0; 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;
Seconds. 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 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;
Var lite = FIND ("menuLite" + x );
Var s = lite. style;
S. height = s. pixelHeight = menu. menuHeight + (menu. menuBorder * 2 );
S. width = s. pixelWidth = menu. menuItemWidth + (menu. menuBorder * 2 );
S. backgroundColor = menu. menuLiteBgColor;
Var body = FIND ("menuFg" + x );
S = body. style;
S. height = s. pixelHeight = menu. menuHeight + menu. menuBorder;
S. width = s. pixelWidth = menu. menuItemWidth + menu. menuBorder;
S. backgroundColor = menu. bgColor;
S = menuLayer. style;
S. width = s. pixelWidth = menu. menuItemWidth + (menu. menuBorder * 4 );
S. height = s. pixelHeight = menu. menuHeight + (menu. menuBorder * 4 );
}
}
If (document. captureEvents ){
Document. captureEvents (Event. MOUSEUP );
}
If (document. addEventListener ){
Document. addEventListener ("mouseup", onMenuItemOver, false );
}
If (document. layers & window. innerWidth ){
Window. onresize = NS4resize;
Window. NS4sIW = window. innerWidth;
Window. NS4sIH = window. innerHeight;
}
Document. onmouseup = mouseupMenu;
Window. fwWroteMenu = true;
Status = "";
}
Function onMenuItemOver (e, l ){
FW_clearTimeout ();
L = l | this;
A = window. ActiveMenuItem;
If (document. layers ){
If (){
A.doc ument. bgColor = a. saveColor;
If (a. hilite) a. hilite. visibility = "hidden ";
If (a. Menu. bgImageOver ){
A. background. src = a. Menu. bgImageUp;
}
A. focusItem. top =-100;
A. clicked = false;
}
If (l. hilite ){
L.doc ument. bgColor = l. menuHiliteBgColor;
L. zIndex = 1;
L. hilite. visibility = "inherit ";
L. hilite. zIndex = 2;
L.doc ument. layers [1]. zIndex = 1;
L. focusItem. zIndex = this. zIndex + 2;
}
If (l. Menu. bgImageOver ){
L. background. src = l. Menu. bgImageOver;
}
L. focusItem. top = this. top;
L. Menu. hideChildMenu (l );
} Else if (l. style & l. Menu ){
If (){
A. style. backgroundColor = a. saveColor;
If (a. hilite) a. hilite. style. visibility = "hidden ";
If (a. Menu. bgImageUp ){
A. style. background = "url (" + a. Menu. bgImageUp + ")";;
}
}
If (l. isSeparator) return;
L. style. backgroundColor = l. menuHiliteBgColor;
L. zIndex = 1; // magic Internet Explorer 4.5 mac happy doohicky. jba
If (l. Menu. bgImageOver ){
L. style. background = "url (" + l. Menu. bgImageOver + ")";
}
If (l. hilite ){
L. style. backgroundColor = l. menuHiliteBgColor;
L. hilite. style. visibility = "inherit ";
}
L. focusItem. style. top = l. focusItem. style. pixelTop = l. style. pixelTop;
L. focusItem. style. zIndex = l. zIndex + 1;
L. Menu. hideChildMenu (l );
} Else {
Return; // not a menu-magic IE 4.5 mac happy doohicky. jba
}
Window. ActiveMenuItem = l;
}
Function onMenuItemAction (e, l ){
L = window. ActiveMenuItem;
If (! L) return;
HideActiveMenus ();
If (l. action ){
Eval ("" + l. action );
}
Window. ActiveMenuItem = 0;
}
Function FW_clearTimeout ()
{
If (fwHideMenuTimer) clearTimeout (fwHideMenuTimer );
FwHideMenuTimer = null;
FwDHFlag = false;
}
Function FW_startTimeout ()
{
FwStart = new Date ();
FwDHFlag = true;
FwHideMenuTimer = setTimeout ("fwDoHide ()", 1000 );
}
Function fwDoHide ()
{
If (! FwDHFlag) return;
Var elapsed = new Date ()-fwStart;
If (elapsed <1000 ){
FwHideMenuTimer = setTimeout ("fwDoHide ()", 1100-elapsed );
Return;
}
FwDHFlag = false;
HideActiveMenus ();
Window. ActiveMenuItem = 0;
}
Function FW_showMenu (menu, x, y, child ){
If (! Window. fwWroteMenu) return;
FW_clearTimeout ();
If (document. layers ){
If (menu ){
Var l = menu. menuLayer | menu;
L. left = 1;
L. top = 1;
HideActiveMenus ();
If (this. visibility) l = this;
Window. ActiveMenu = l;
} Else {
Var l = child;
}
If (! L) return;
For (var I = 0; I If (! L. layers [I]. isHilite)
L. layers [I]. visibility = "inherit ";
If (l.layerspolici2.16.doc ument. layers. length> 0)
FW_showMenu (null, "relative", "relative", l. layers [I]);
}
If (l. parentLayer ){
If (x! = "Relative ")
L. parentLayer. left = x | window. pageX | 0;
If (l. parentLayer. left + l. clip. width> window. innerWidth)
L. parentLayer. left-= (l. parentLayer. left + l. clip. width-window. innerWidth );
If (y! = "Relative ")
L. parentLayer. top = y | window. pageY | 0;
If (l. parentLayer. isContainer ){
L. Menu. xOffset = window. pageXOffset;
L. Menu. yOffset = window. pageYOffset;
L. parentLayer. clip. width = window. ActiveMenu. clip. width + 2;
L. parentLayer. clip. height = window. ActiveMenu. clip. height + 2;
If (l. parentLayer. menuContainerBgColor) l.parentLayer.doc ument. bgColor = l. parentLayer. menuContainerBgColor;
}
}
L. visibility = "inherit ";
If (l. Menu) l. Menu. container. visibility = "inherit ";
} Else if (FIND ("menuItem0 ")){
Var l = menu. menuLayer | menu;
HideActiveMenus ();
If (typeof (l) = "string "){
L = FIND (l );
}
Window. ActiveMenu = l;
Var s = l. style;
S. visibility = "inherit ";
If (x! = "Relative ")
S. left = s. pixelLeft = x | (window. pageX + document. body. scrollLeft) | 0;
If (y! = "Relative ")
S. top = s. pixelTop = y | (window. pageY + document. body. scrollTop) | 0;
L. Menu. xOffset = document. body. scrollLeft;
L. Menu. yOffset = document. body. scrollTop;
}
If (menu ){
Window. activeMenus [window. activeMenus. length] = l;
}
}
Function onMenuItemDown (e, l ){
Var a = window. ActiveMenuItem;
If (document. layers ){
If (){
A. eX = e. pageX;
A. eY = e. pageY;
A. clicked = true;
}
}
}
Function mouseupMenu (e)
{
HideMenu (true, e );
HideActiveMenus ();
Return true;
}
Function hideMenu (mouseup, e ){
Var a = window. ActiveMenuItem;
If (a & document. layers ){
A.doc ument. bgColor = a. saveColor;
A. focusItem. top =-30;
If (a. hilite) a. hilite. visibility = "hidden ";
If (mouseup & a. action & a. clicked & window. ActiveMenu ){
If (. eX <= e. pageX + 15 &. eX> = e. pageX-15 &. eY <= e. pageY + 10 &. eY> = e. pageY-10 ){
SetTimeout ('window. ActiveMenu. Menu. onMenuItemAction (); ', 2 );
}
}
A. clicked = false;
If (a. Menu. bgImageOver ){
A. background. src = a. Menu. bgImageUp;
}
} Else if (window. ActiveMenu & FIND ("menuItem0 ")){
If (){
A. style. backgroundColor = a. saveColor;
If (a. hilite) a. hilite. style. visibility = "hidden ";
If (a. Menu. bgImageUp ){
A. style. background = "url (" + a. Menu. bgImageUp + ")";;
}
}
}
If (! Mouseup & window. ActiveMenu ){
If (window. ActiveMenu. Menu ){
If (window. ActiveMenu. Menu. hideOnMouseOut ){
FW_startTimeout ();
}
Return (true );
}
}
Return (true );
}
Function PxToNum (pxStr)
{// PxStr = 27px, we want 27.
If (pxStr. length> 2 ){
N = Number (pxStr. substr (0, pxStr. length-2 ));
Return (n );
}
Return (0 );
}
Function hideChildMenu (hcmLayer ){
FW_clearTimeout ();
Var l = hcmLayer;
For (var I = 0; I <l. Menu. childMenus. length; I ++ ){
Var theLayer = l. Menu. childMenus [I];
If (document. layers ){
TheLayer. visibility = "hidden ";
} Else {
TheLayer = FIND (theLayer );
TheLayer. style. visibility = "hidden ";
}
TheLayer. Menu. hideChildMenu (theLayer );
}
If (l. childMenu ){
Var childMenu = l. childMenu;
If (document. layers ){
L. Menu. FW_showMenu (null, childMenu. layers [0]);
ChildMenu. zIndex = l. parentLayer. zIndex + 1;
ChildMenu. top = l. top + l. parentLayer. top + l. Menu. menuLayer. top + l. Menu. menuItemHeight/3;
If (childMenu. left + childMenu. clip. width> window. innerWidth ){
ChildMenu. left = l. parentLayer. left-childMenu. clip. width + l. Menu. menuLayer. left + 15;
L. Menu. container. clip. left-= childMenu. clip. width;
} Else {
ChildMenu. left = l. parentLayer. left + l. parentLayer. clip. width + l. Menu. menuLayer. left-5;
}
Var w = childMenu. clip. width + childMenu. left-l.Menu.container.clip.left;
If (w> l. Menu. container. clip. width)
L. Menu. container. clip. width = w;
Var h = childMenu. clip. height + childMenu. top-l.Menu.container.clip.top;
If (h> l. Menu. container. clip. height) l. Menu. container. clip. height = h;
L.doc ument. layers [1]. zIndex = 0;
ChildMenu. visibility = "inherit ";
} Else if (FIND ("menuItem0 ")){
ChildMenu = FIND (l. childMenu );
Var menuLayer = FIND (l. Menu. menuLayer );
Var s = childMenu. style;
S. zIndex = menuLayer. style. zIndex + 1;
If (document. all) {// ie case.
S. pixelTop = l. style. pixelTop + menuLayer. style. pixelTop + l. Menu. menuItemHeight/3;
S. left = s. pixelLeft = (menuLayer. style. pixelWidth) + menuLayer. style. pixelLeft-5;
} Else {// zilla case
Var top = PxToNum (l. style. top) + PxToNum (menuLayer. style. top) + l. Menu. menuItemHeight/3;
Var left = (PxToNum (menuLayer. style. width) + PxToNum (menuLayer. style. left)-5;
S. top = top;
S. left = left;
}
ChildMenu. style. visibility = "inherit ";
} Else {
Return;
}
Window. activeMenus [window. activeMenus. length] = childMenu;
}
}
Function hideActiveMenus (){
If (! Window. activeMenus) return;
For (var I = 0; I <window. activeMenus. length; I ++ ){
If (! ActiveMenus [I]) continue;
If (activeMenus [I]. visibility & activeMenus [I]. Menu ){
ActiveMenus [I]. visibility = "hidden ";
ActiveMenus [I]. Menu. container. visibility = "hidden ";
ActiveMenus [I]. Menu. container. clip. left = 0;
} Else if (activeMenus [I]. style ){
Var s = activeMenus [I]. style;
S. visibility = "hidden ";
Seconds. left =-200;
S. top =-200;
}
}
If (window. ActiveMenuItem ){
HideMenu (false, false );
}
Window. activeMenus. length = 0;
}
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service