中文(简体)
<!-- 把如下代码加入<body>区域中 --> <!-- web http://www.downcodes.com --> <!-- bbs http://www.downcodes.com/bbs- -> <style rel=stylesheet type=text/css> BODY { BORDER-BOTTOM: 0px;左边框:0px;右边框:0px;顶部边框:0px;边距:0 像素;颜色:buttontext } #menu { 背景:buttonface; BORDER-BOTTOM:按钮面 1px 实心;左边框:按钮面 1px 实心;右边框:按钮面 1px 实心; BORDER-TOP:按钮面 1px 实心;光标:默认;左:0 像素;位置:绝对;顶部:0px } #menu .menu { 背景:buttonface; BORDER-BOTTOM:按钮突出显示 2px 开始; BORDER-LEFT:按钮突出显示 2px 开始; BORDER-RIGHT:按钮突出显示 2px 开始; BORDER-TOP:按钮突出显示 2px 开始;位置:绝对 } #menu TD { 字体:菜单;高度:20px } #menu .root { 边框-底部:按钮面 1px 实心;左边框:按钮面 1px 实心;右边框:按钮面 1px 实心; BORDER-TOP:按钮面 1px 实心;边距:6 像素;底部填充:1px;左内边距:7px;右内边距:7px; PADDING-TOP: 1px } #menu .icon { TEXT-ALIGN: center } #menu .disabled { COLOR: buttonshadow } #menu .more { FONT-FAMILY: webdings;文本对齐:右;宽度:20px } #menu #handle { 边框底部:buttonshadow 1px 实心; BORDER-LEFT:按钮突出显示 1px 实心;右边框:buttonshadow 1px 实心; BORDER-TOP:按钮突出显示 1px 实心;光标:移动;边距:0 像素;底部填充:0px;左内边距:0px;右内边距:0px; PADDING-TOP: 0px } #outerDiv { BORDER-BOTTOM: 白色 2px 插图;左边框:白色 2px 插图;右边框:白色 2px 插图; BORDER-TOP:白色 2px 插图;身高:90%;溢出:自动;位置:绝对;宽度:100%; Z-INDEX: -1 } </style> <SCRIPT> var activeMenu = null; var activeSub = null; var tempEl;变量t; var hideWindowedControls = true; var ie5 = (document.getElementsByTagName != null); function menuItemHighlight(el) { el.style.background = "突出显示"; el.style.color = "突出显示文本"; } function menuItemNormal(el) { el.style.background = ""; el.style.color = ""; } function raiseButton(el) { el.style.borderTop ="1 实体按钮突出显示"; el.style.borderLeft =“1 个实心按钮突出显示”; el.style.borderBottom =“1 个实心按钮阴影”; el.style.borderRight ="1 个实心按钮阴影"; el.style.padding =“1”; el.style.paddingLeft = "7"; el.style.paddingRight = "7"; } function normalButton(el) { el.style.border = "1 个实心按钮面"; el.style.padding =“1”; el.style.paddingLeft = "7"; el.style.paddingRight = "7"; } function PressedButton(el) { el.style.borderTop ="1 实心按钮阴影"; el.style.paddingTop = "2"; el.style.borderLeft =“1 个实心按钮阴影”; el.style.paddingLeft = "8"; el.style.borderBottom =“1 个实心按钮突出显示”; el.style.paddingBottom=“0”; el.style.borderRight = "1 个实心按钮突出显示"; el.style.paddingRight = "6"; } function cleanUpMenuBar() { for (i=0; i <menu.rows.length; i++) { for (j=0; j <menu.rows(i).cells.length; j++) { if (menu.rows (i).cells(j).className == "root") { normalButton(menu.rows(i).cells(j)); showWindowedObjects(true); } 函数 getMenuItem(el) { temp = el; while ((temp!=null) && (temp.tagName!="TABLE") && (temp.id!="menubar") && (temp.id!="menu") && (temp.id!="handle ")) { if ((temp.tagName=="TR") || (temp.className=="root")) el = temp; temp = temp.parentElement;返回el; } 函数 getSub(el) { temp = el; while ((temp!=null) && (temp.className != "sub")) { if (temp.tagName=="TABLE") el = temp; temp = temp.parentElement;返回el; } function menuClick() { if (event.srcElement == null) return; } var el=getMenuItem(event.srcElement); if ((el.className != "disabled") && (el.id != "menubar")){ if (el.className == "root") { if (activeMenu) { raiseButton(el); }显示窗口对象(真);否则按下按钮(el);切换菜单(el); } else if (el.href) { cleanUpMenuBar();如果(activeMenu)toggleMenu(activeMenu.parentElement); if (el.target) window.open(el.href, el.target); else if (document.all.tags("BASE").item(0) != null) window.open(el.href, document.all.tags("BASE").item(0).target);否则 window.location = el.href; } } window.event.cancelBubble = true; } 函数 Restore() { if (activeMenu) {toggleMenu(activeMenu.parentElement);清理菜单栏(); document.onclick=恢复; function menuOver() { if ((event.fromElement == null) || (event.toElement == null) || (event.fromElement == event.toElement)) return; } var fromEl = getMenuItem(event.fromElement); var toEl = getMenuItem(event.toElement); if (fromEl == toEl) 返回; if ((toEl.className != "disabled") && (toEl.id != "menubar")){ if (toEl.className == "root") { if (activeMenu) { if (toEl.menu != activeMenu) ) { cleanUpMenuBar();按下按钮(toEl);切换菜单(toEl); } } else { raiseButton(toEl); } } else { if ((fromEl != toEl) && (toEl.tagName != "TABLE")){ cleanup(toEl.parentElement.parentElement, false);菜单项突出显示(toEl); toEl.parentElement.parentElement.activeItem = toEl; if (toEl.href) window.status = toEl.href; if (toEl.className == "sub") showSubMenu(toEl,true); } } } } function menuOut() { if ((event.fromElement == null) || (event.toElement == null) || (event.fromElement == event.toElement)) return; var fromEl = getMenuItem(event.fromElement); var toEl = getMenuItem(event.toElement); if (fromEl == toEl) 返回; if (fromEl.className == "root"){ if (activeMenu) { if (fromEl.menu != activeMenu) normalButton(fromEl); }否则正常按钮(fromEl); } else { if ((fromEl.className != "disabled") && (fromEl.id != "menubar")){ if ((fromEl.className == "sub") && (getSub(toEl) == fromEl. subMenu) || (fromEl.subMenu == toEl.parentElement.parentElement)) 返回; else if ((fromEl.className == "sub")){ cleanup(fromEl.subMenu, true); } menuItemNormal(fromEl); } else if ((fromEl != toEl) && (fromEl.tagName != "TABLE")) menuItemNormal(fromEl);窗口状态=“”; } } } 函数toggleMenu(el) { if (el.menu == null) el.menu = getChildren(el); if (el.menu == activeMenu) { if (activeSub) menuItemNormal(activeSub.parentElement.parentElement); }清理(el.menu,true);活动菜单=空; activeSub = null; // showWindowedObjects(true); } else { if (activeMenu) { cleanup(activeMenu,true); }隐藏菜单(活动菜单); } activeMenu = el.menu; var tPos = topPos(el.menu) + menu.offsetHeight; if ((document.body.offsetHeight - tPos) >= el.menu.offsetHeight) { el.menu.style.pixelTop = (ie5) ? el.offsetHeight + 1 : menu.offsetHeight - el.offsetTop - 2;目录=2; } else { el.menu.style.pixelTop = (ie5) ? el.offsetTop - el.menu.offsetHeight - 1 : el.offsetTop - el.menu.offsetHeight + 2;目录=8; } el.menu.style.pixelLeft = (ie5) ? el.offsetLeft - 2 : el.offsetLeft;显示(el.菜单,目录);显示窗口对象(假); } } 函数 showSubMenu(el,show) { var dir = 2;温度=埃尔;列表 = el.children.tags("TD"); el = list[list.length-1]; if (el.menu == null) el.menu = getChildren(el); temp.subMenu = el.menu; if ((el.menu != activeMenu) && (show)) { activeSub = el.menu; var lPos = leftPos(el.menu); if ((document.body.offsetWidth - lPos) >= el.menu.offsetWidth) { el.menu.style.left = (ie5) ? el.parentNode.offsetWidth : el.offsetParent.offsetWidth;目录=6; } else { el.menu.style.left = - el.menu.offsetWidth + 3;目录=4; } var tPos = (ie5) ? topPos(el.menu) + el.offsetTop : topPos(el.menu) + el.offsetParent.offsetTop;// + el.menu.offsetTop; if ((document.body.offsetHeight - tPos) >= el.menu.offsetHeight) el.menu.style.top = (ie5) ? el.offsetTop - 4 : el.offsetParent.offsetTop - 2;否则 el.menu.style.top = (ie5) ? el.offsetTop + el.offsetHeight - el.menu.offsetHeight : el.offsetParent.offsetTop + el.offsetParent.offsetHeight - el.menu.offsetHeight + 2; showSub(el.menu, dir); } else { 显示(el.menu ,dir); activeSub = null; } } 函数 topPos(el) { var temp = el; var y = 0; while (temp.id!="menu") { temp = temp.offsetParent; y += temp.offsetTop;返回y; } 函数 leftPos(el) { var temp = el; var x = 0; while (temp.id!="menu") { temp = temp.offsetParent; x += temp.offsetLeft;返回 x + el.offsetParent.offsetWidth; } function show(el, dir) { if (typeof(fade) == "function") fade(el, true); } else if (typeof(swipe) == "函数") { tempElSwipe = el; tempDirSwipe = 目录; el.style.visibility = "可见"; el.style.visibility = "隐藏"; window.setTimeout("tempSwipe()", 0); // 滑动(el,目录); } else el.style.visibility = "可见"; } var tempElSwipe, tempDirSwipe;函数 tempSwipe() { swipe(tempElSwipe, tempDirSwipe); } 函数 showSub(el ,dir) { show(el, dir); // 滑动(el,目录); // 淡入淡出(el, true); // el.style.visibility = "可见"; } function cleanup(menu,hide) { if (menu.activeItem) { //如果你以前来过这里 if ((menu.activeItem.className == "sub") && (menu.activeItem.subMenu)){ / /活动项有子菜单cleanup(menu.activeItem.subMenu, true); //也清理子项 } menuItemNormal(menu.activeItem); } if (隐藏) { hideMenu(菜单); } } 函数 hideMenu(el) { if (typeof(fade) == "function") { fade(el, false); // window.setTimeout(fadeTimer); } else if (typeof(swipe) == "函数") { hideSwipe(el); } else el.style.visibility = "隐藏"; } function getChildren(el) { var tList = el.children.tags("TABLE");返回tList[0]; } var DragObject = null; var DragObjectPos = "顶部"; var tx;变种; window.onload=fixSize; window.onresize=fixSize;函数fixSize(){ if(dragObjectPos ==“顶部”){outerDiv.style.top = menu.offsetHeight; externalDiv.style.height = document.body.clientHeight - menu.offsetHeight; } else if(dragObjectPos == "bottom") {outerDiv.style.top = 0; externalDiv.style.height = document.body.clientHeight - menu.offsetHeight; menu.style.top = document.body.clientHeight - menu.offsetHeight; } else { 外层Div.style.top = 0; externalDiv.style.height=document.body.clientHeight; } } function document.onmousedown() { if(window.event.srcElement.id == "handle") { DragObject = document.all[window.event.srcElement.getAttribute("for")];恢复(); //移动时隐藏菜单 ty = (window.event.clientY - DragObject.style.pixelTop); window.event.returnValue = false; window.event.cancelBubble = true; } else { 拖动对象 = null; } } function document.onmouseup() { if(dragObject) { DragObject = null; } } function document.onmousemove() { if(dragObject) { if(window.event.clientX >= 0) { if((window.event.clientY - ty) <= 15) { DragObject.style.border = "0实心按钮面”; DragObject.style.width = "100%";拖动对象.style.top = 0;拖动对象.style.left = 0; DragObjectPos = "顶部";修复大小(); } else if ((window.event.clientY - ty) >= document.body.clientHeight - menu.offsetHeight - 15) { DragObject.style.border = "0 实体按钮面"; DragObject.style.width = "100%"; DragObject.style.top = document.body.clientHeight - menu.offsetHeight;拖动对象.style.left = 0; DragObjectPos =“底部”;修复大小(); } else { DragObject.style.width =“10px”; DragObject.style.left = window.event.clientX; DragObject.style.top = window.event.clientY - ty; DragObject.style.border = "2px 开头白色"; DragObjectPos = "浮动";修复大小(); } } else { DragObject.style.border = ""; DragObject.style.left =“0”; DragObject.style.top = "0"; } window.event.returnValue = false; window.event.cancelBubble = true; } } function showWindowedObjects(show) { if (hideWindowedControls) { var windowedObjectTags = new Array("SELECT", "IFRAME", "OBJECT", "APPLET","EMBED"); var windowedObjects = new Array();变量j=0; for (var i=0; i<windowedObjectTags.length; i++) { var tmpTags = document.all.tags(windowedObjectTags[i]); if (tmpTags.length > 0) { for (var k=0; k<tmpTags.length; k++) { windowedObjects[j++] = tmpTags[k]; } for (var i=0; i<windowedObjects.length; i++) { if (!show) windowedObjects[i].visBackup = (windowedObjects[i].style.visibility == null) ? “可见”:windowedObjects[i].style.visibility; windowedObjects[i].style.visibility = (显示) ? windowedObjects[i].visBackup : "隐藏"; } } } </SCRIPT> <TABLE cellSpacing=1 id=menu onclick=menuClick() onmouseout=menuOut() onmouseover=menuOver() onselectstart="return false"> <TBODY> <TR id=menubar> <TD class= disabled style="PADDING-LEFT: 0px; PADDING-RIGHT: 1px"> <DIV class=disabled id=handle style="HEIGHT: 100%; LEFT: 3px; WIDTH: 3px" title="移动我!" for="menu"></DIV></TD> <TD class=root>HOME <TABLE cellSpacing=0 class=menu style="VISIBILITY: hide"> <TBODY> <TR href="javascript:alert('可以改成一个链接!')"> <TD></TD> <TD noWrap>LINK</TD> <TD></TD> </TR> <TR class=sub> <TD></TD> <TD noWrap>LINK</TD> <TD> <TABLE cellSpacing=0 class=menu style="VISIBILITY: hide"> <TBODY> <TR href="javascript:alert('可以改成一个链接')"> <TD noWrap style="HEIGHT: 20px">链接</TD> </TR> </TBODY> </TABLE> </TD> </TR> <TR class=disabled> <TD colSpan=3> <HR > </TD> </TR> <TR href="javascript:alert('可以改成一个链接')"> <TD></TD> <TD>LINK</TD> <TD></TD> </TR> <TR title="这真的很简单"> <TD></TD> <TD>LINK</TD> <TD></TD> </TR> </TBODY> </TABLE> < /TD> <TD class=root>帮助 <TABLE cellSpacing=0 class=menu style="VISIBILITY: hide"> <TBODY> <TR href="javascript:alert('www.downcodes.com')"> <TD ></TD> <TD>关于</TD> <TD></TD></TR></TBODY></TABLE></TD> <TD class=disabled width="100%"> </ TD></TR></TBODY></TABLE> <DIV id=outerDiv>