复制代码 代码如下: <BR>.menu { BORDER-RIGHT: #006080 2px solid; BORDER-TOP: #80e0ff 2px solid; LEFT: 0px; VISIBILITY: hidden; BORDER-LEFT: #80e0ff 2px solid; BORDER-BOTTOM: #006080 2px solid; POSITION: absolute; TOP: 0px; BACKGROUND-COLOR: #40a0c0 } <BR>A.menuItem { BORDER-RIGHT: #000000 0px solid; PADDING-RIGHT: 12px; BORDER-TOP: #000000 0px solid; DISPLAY: block; PADDING-LEFT: 8px; FONT-WEIGHT: bold; FONT-SIZE: 8pt; PADDING-BOTTOM: 2px; BORDER-LEFT: #000000 0px solid; CURSOR: default; COLOR: #ffffff; PADDING-TOP: 2px; BORDER-BOTTOM: #000000 0px solid; FONT-FAMILY: MS Sans Serif, Arial, Tahoma, sans-serif; TEXT-DECORATION: none } <BR>A.menuItem:hover { COLOR: #ffff00; BACKGROUND-COLOR: #004060 } <BR> href="http://www.jb51.net">脚本之家 href="http://www.baidu.com">百度 href="">网 易 href="">江苏音符 href="">央视国际 点击打开菜单 <BR>document.getElementById("myMenu").onmouseout = closeMenu; <BR>function openMenu(event, id) { <BR>var el, x, y; <BR>el = document.getElementById(id); <BR>if (window.event) { <BR>x = window.event.clientX + document.documentElement.scrollLeft <BR>+ document.body.scrollLeft; <BR>y = window.event.clientY + document.documentElement.scrollTop + <BR>+ document.body.scrollTop; <BR>} <BR>else { <BR>x = event.clientX + window.scrollX; <BR>y = event.clientY + window.scrollY; <BR>} <BR>x -= 2; y -= 2; <BR>el.style.left = x + "px"; <BR>el.style.top = y + "px"; <BR>el.style.visibility = "visible"; <BR>} <BR>function closeMenu(event) { <BR>var current, related; <BR>if (window.event) { <BR>current = this; <BR>related = window.event.toElement; <BR>} <BR>else { <BR>current = event.currentTarget; <BR>related = event.relatedTarget; <BR>} <BR>if (current != related && !contains(current, related)) <BR>current.style.visibility = "hidden"; <BR>} <BR>function contains(a, b) { <BR>// Return true if node a contains node b. <BR>while (b.parentNode) <BR>if ((b = b.parentNode) == a) <BR>return true; <BR>return false; <BR>} <BR>