分享
 
 
 

可与IE整合、分离的导航条下拉菜单

王朝other·作者佚名  2006-11-24
窄屏简体版  字體: |||超大  

有什么问题请到<a href='/bbs/forums.php?fid=21'>论坛</a>中发表<br>

<!-- 把如下代码加入<body>区域中 -->

<!-- web http://www.webjx.com -->

<!-- bbs http://www.webjx.com/bbs-->

<style rel=stylesheet type=text/css>

BODY {

BORDER-BOTTOM: 0px; BORDER-LEFT: 0px; BORDER-RIGHT: 0px; BORDER-TOP: 0px; MARGIN: 0px; color: buttontext

}

#menu {

BACKGROUND: buttonface; BORDER-BOTTOM: buttonface 1px solid; BORDER-LEFT: buttonface 1px solid; BORDER-RIGHT: buttonface 1px solid; BORDER-TOP: buttonface 1px solid; CURSOR: default; LEFT: 0px; POSITION: absolute; TOP: 0px

}

#menu .menu {

BACKGROUND: buttonface; BORDER-BOTTOM: buttonhighlight 2px outset; BORDER-LEFT: buttonhighlight 2px outset; BORDER-RIGHT: buttonhighlight 2px outset; BORDER-TOP: buttonhighlight 2px outset; POSITION: absolute

}

#menu TD {

FONT: menu; HEIGHT: 20px

}

#menu .root {

BORDER-BOTTOM: buttonface 1px solid; BORDER-LEFT: buttonface 1px solid; BORDER-RIGHT: buttonface 1px solid; BORDER-TOP: buttonface 1px solid; MARGIN: 6px; PADDING-BOTTOM: 1px; PADDING-LEFT: 7px; PADDING-RIGHT: 7px; PADDING-TOP: 1px

}

#menu .icon {

TEXT-ALIGN: center

}

#menu .disabled {

COLOR: buttonshadow

}

#menu .more {

FONT-FAMILY: webdings; TEXT-ALIGN: right; WIDTH: 20px

}

#menu #handle {

BORDER-BOTTOM: buttonshadow 1px solid; BORDER-LEFT: buttonhighlight 1px solid; BORDER-RIGHT: buttonshadow 1px solid; BORDER-TOP: buttonhighlight 1px solid; CURSOR: move; MARGIN: 0px; PADDING-BOTTOM: 0px; PADDING-LEFT: 0px; PADDING-RIGHT: 0px; PADDING-TOP: 0px

}

#outerDiv {

BORDER-BOTTOM: white 2px inset; BORDER-LEFT: white 2px inset; BORDER-RIGHT: white 2px inset; BORDER-TOP: white 2px inset; HEIGHT: 90%; OVERFLOW: auto; POSITION: absolute; WIDTH: 100%; Z-INDEX: -1

}

</style>

<SCRIPT>

var activeMenu = null;

var activeSub = null;

var tempEl;

var t;

var hideWindowedControls = true;

var ie5 = (document.getElementsByTagName != null);

function menuItemHighlight(el) {

el.style.background = "highlight";

el.style.color = "highlighttext";

}

function menuItemNormal(el) {

el.style.background = "";

el.style.color = "";

}

function raiseButton(el) {

el.style.borderTop ="1 solid buttonhighlight";

el.style.borderLeft ="1 solid buttonhighlight";

el.style.borderBottom ="1 solid buttonshadow";

el.style.borderRight ="1 solid buttonshadow";

el.style.padding ="1";

el.style.paddingLeft = "7";

el.style.paddingRight = "7";

}

function normalButton(el) {

el.style.border = "1 solid buttonface";

el.style.padding ="1";

el.style.paddingLeft = "7";

el.style.paddingRight = "7";

}

function pressedButton(el) {

el.style.borderTop ="1 solid buttonshadow";

el.style.paddingTop = "2";

el.style.borderLeft ="1 solid buttonshadow";

el.style.paddingLeft = "8";

el.style.borderBottom ="1 solid buttonhighlight";

el.style.paddingBottom= "0";

el.style.borderRight = "1 solid buttonhighlight";

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);

}

function 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;

}

return el;

}

function getSub(el) {

temp = el;

while ((temp!=null) && (temp.className != "sub")) {

if (temp.tagName=="TABLE")

el = temp;

temp = temp.parentElement;

}

return 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);

showWindowedObjects(true);

}

else

pressedButton(el);

toggleMenu(el);

}

else if (el.href) {

cleanUpMenuBar();

if (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);

else

window.location = el.href;

}

}

window.event.cancelBubble = true;

}

function Restore() {

if (activeMenu) {

toggleMenu(activeMenu.parentElement);

cleanUpMenuBar();

}

}

document.onclick=Restore;

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)

return;

if ((toEl.className != "disabled") && (toEl.id != "menubar")){

if (toEl.className == "root") {

if (activeMenu) {

if (toEl.menu != activeMenu) {

cleanUpMenuBar();

pressedButton(toEl);

toggleMenu(toEl);

}

}

else {

raiseButton(toEl);

}

}

else {

if ((fromEl != toEl) && (toEl.tagName != "TABLE")){

cleanup(toEl.parentElement.parentElement, false);

menuItemHighlight(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)

return;

if (fromEl.className == "root"){

if (activeMenu) {

if (fromEl.menu != activeMenu)

normalButton(fromEl);

}

else

normalButton(fromEl);

}

else {

if ((fromEl.className != "disabled") && (fromEl.id != "menubar")){

if ((fromEl.className == "sub") && (getSub(toEl) == fromEl.subMenu) || (fromEl.subMenu == toEl.parentElement.parentElement))

return;

else if ((fromEl.className == "sub")){

cleanup(fromEl.subMenu, true);

menuItemNormal(fromEl);

}

else if ((fromEl != toEl) && (fromEl.tagName != "TABLE"))

menuItemNormal(fromEl);

window.status = "";

}

}

}

function toggleMenu(el) {

if (el.menu == null)

el.menu = getChildren(el);

if (el.menu == activeMenu) {

if (activeSub)

menuItemNormal(activeSub.parentElement.parentElement);

cleanup(el.menu,true);

activeMenu = null;

activeSub = null;

// showWindowedObjects(true);

}

else {

if (activeMenu) {

cleanup(activeMenu,true);

hideMenu(activeMenu);

}

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;

dir = 2;

}

else {

el.menu.style.pixelTop = (ie5) ? el.offsetTop - el.menu.offsetHeight - 1

: el.offsetTop - el.menu.offsetHeight + 2;

dir = 8;

}

el.menu.style.pixelLeft = (ie5) ? el.offsetLeft - 2 : el.offsetLeft;

show(el.menu, dir);

showWindowedObjects(false);

}

}

function showSubMenu(el,show) {

var dir = 2;

temp = el;

list = 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;

dir = 6;

}

else {

el.menu.style.left = - el.menu.offsetWidth + 3;

dir = 4;

}

var tPos = (

[1] [2] 下一页

 
 
 
免责声明:本文为网络用户发布,其观点仅代表作者个人观点,与本站无关,本站仅提供信息存储服务。文中陈述内容未经本站证实,其真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
2023年上半年GDP全球前十五强
 百态   2023-10-24
美众议院议长启动对拜登的弹劾调查
 百态   2023-09-13
上海、济南、武汉等多地出现不明坠落物
 探索   2023-09-06
印度或要将国名改为“巴拉特”
 百态   2023-09-06
男子为女友送行,买票不登机被捕
 百态   2023-08-20
手机地震预警功能怎么开?
 干货   2023-08-06
女子4年卖2套房花700多万做美容:不但没变美脸,面部还出现变形
 百态   2023-08-04
住户一楼被水淹 还冲来8头猪
 百态   2023-07-31
女子体内爬出大量瓜子状活虫
 百态   2023-07-25
地球连续35年收到神秘规律性信号,网友:不要回答!
 探索   2023-07-21
全球镓价格本周大涨27%
 探索   2023-07-09
钱都流向了那些不缺钱的人,苦都留给了能吃苦的人
 探索   2023-07-02
倩女手游刀客魅者强控制(强混乱强眩晕强睡眠)和对应控制抗性的关系
 百态   2020-08-20
美国5月9日最新疫情:美国确诊人数突破131万
 百态   2020-05-09
荷兰政府宣布将集体辞职
 干货   2020-04-30
倩女幽魂手游师徒任务情义春秋猜成语答案逍遥观:鹏程万里
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案神机营:射石饮羽
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案昆仑山:拔刀相助
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案天工阁:鬼斧神工
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案丝路古道:单枪匹马
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:与虎谋皮
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:李代桃僵
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:指鹿为马
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案金陵:小鸟依人
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案金陵:千金买邻
 干货   2019-11-12
 
推荐阅读
 
 
 
>>返回首頁<<
 
靜靜地坐在廢墟上,四周的荒凉一望無際,忽然覺得,淒涼也很美
© 2005- 王朝網路 版權所有