ms_dos

  博客园  :: 首页  :: 新随笔  ::  :: 订阅 订阅  :: 管理

非常棒的绿色下拉透明菜单
http://www.jscode.cn/JsHtml/Js679.htm
模仿Flash AS效果的导航菜单
http://www.jscode.cn/JsHtml/Js589.htm

文件夹式的菜单
http://www.jscode.cn/JsHtml/Js515.htm

点击文字让层移动的菜单
http://www.jscode.cn/JsHtml/Js502.htm

极酷的多级右键菜单
http://www.jscode.cn/JsHtml/Js456.htm

模拟QQ菜单效果
http://www.jscode.cn/JsHtml/Js458.htm

自动收缩的菜单
http://www.jscode.cn/JsHtml/Js57.htm

类似Windows的极品导航菜单
http://www.jscode.cn/JsHtml/Js70.htm

用CSS设计的导航实例
http://www.jscode.cn/JsHtml/Js724.htm

极品效果-3dapple菜单
http://www.jscode.cn/JsHtml/Js678.htm

滑出式网页导航菜单
<!-- +++滑出式网页导航菜单+++++ -->
<html>
<head>
<!-- +++++以下代码加入<head>区域+++++ -->
<style>
body,td,a {font-size:9pt;color:black;text-decoration:none}
.normal {padding:2px}
.up {padding:1px;border:#999999 1px solid;background:#cccccc}
.down {padding:1px;border:dbdbdb 1px solid;background:dbdbdb}
.menuv {filter: revealTrans(transition=23,duration=0.5);padding:2px}
</style>
</head>
<!-- +++++++++++++++++++++++++++++++++以下代码加入<body>区域++++++++++++++++++++++++++++++++++ -->
<body onMouseMove="move()" onLoad="bodyload()">
<script>
//闪烁的表格边框
function flashit(){if(!document.all)return;if (td123.style.borderColor=="black")td123.style.borderColor="#999999";else td123.style.borderColor="black"}setInterval("flashit()",500)
//渐入的效果,改变alpha值
function high(image){theobject=image,highlighting=setInterval("highlightit(theobject)",100)}function low(image){clearInterval(highlighting),image.filters.alpha.opacity=50}function highlightit(cur2){if (cur2.filters.alpha.opacity<100)cur2.filters.alpha.opacity+=20;else if(window.highlighting)clearInterval (highlighting)}
//拖动层的js
var over=false,down=false,divleft,divtop;function move(){if(down){plane.style.left=event.clientX-divleft;plane.style.top=event.clientY-divtop;}}
//滑动层
function bodyload()
{
if(plane.style.pixelTop!=0)
{
plane.style.pixelTop-=10
setTimeout('bodyload()',1)
}
}
//渐变显示层
function Show(divid) {
divid.filters.revealTrans.apply();
divid.style.visibility = "visible";
divid.filters.revealTrans.play();
}
function Hide(divid) {
divid.filters.revealTrans.apply();
divid.style.visibility = "hidden";
divid.filters.revealTrans.play();
}
</script>
<div style="position:absolute;z-index:1;width:1;height:1; left: 0; top: 500" ID=plane onmousedown="down=true;divleft=event.clientX-parseInt(plane.style.left);divtop=event.clientY-parseInt(plane.style.top)" onmouseup="down=false">
  <table id="td123" cellspacing=2 width=100 border=0 style="BORDER:#999999 1px solid;cursor:hand" cellpadding="0" bgcolor="f4f4f4">
<tr>
<td bgcolor="#cccccc" height="20" style="BORDER:#999999 1px solid;cursor:move">
<div align="center">多级滑动菜单</div>
</td>
</tr>
<tr>
<td class=normal onMouseDown="this.className='down'"
onMouseOver="this.className='up',high(this),Show(menu1)
" onMouseOut="this.className='normal',low(this),menu1.style.visibility='hidden'" style="filter:alpha(opacity=50)"onMouseUp="this.className='up'" >
<div align="right">有下级菜单>></div>
</td>
</tr>
<tr>
<td class=normal onMouseDown="this.className='down'"
onMouseOver="this.className='up',high(this),Show(menu2)" onMouseOut="this.className='normal',low(this),menu2.style.visibility='hidden'" style="filter:alpha(opacity=50)"onMouseUp="this.className='up'" >
<div align="right">有下级菜单>></div>
</td>
</tr>
<tr>
<td class=normal onMouseDown="this.className='down'"
onMouseOver="this.className='up',high(this)" onMouseOut="this.className='normal',low(this)" style="filter:alpha(opacity=50)"onMouseUp="this.className='up'">
<div align="right">无下级菜单>></div>
</td>
</tr>
<tr>
<td class=normal onMouseDown="this.className='down'"
onMouseOver="this.className='up',high(this)" onMouseOut="this.className='normal',low(this)" style="filter:alpha(opacity=50)"onMouseUp="this.className='up'">
<div align="right">无下级菜单>></div>
</td>
</tr>
</table>
<div id="menu1" style="position:absolute;top:24px;left:96px; z-index:1; visibility: hidden; width: 105"
onMouseOver=this.style.visibility='visible'
onMouseOut=this.style.visibility='hidden' class="menuv">
<table cellspacing=2 width=100 border=0 style="BORDER:#999999 1px solid;cursor:hand" cellpadding="0" bgcolor="f4f4f4" align="right">
<tr>
<td class=normal onMouseDown="this.className='down'"
onMouseOver="this.className='up',high(this)" onMouseOut="this.className='normal',low(this)" style="filter:alpha(opacity=50)"onMouseUp="this.className='up'">
<div align="center">子菜单</div>
</td>
</tr>
<tr>
<td class=normal onMouseDown="this.className='down'"
onMouseOver="this.className='up',high(this)" onMouseOut="this.className='normal',low(this)" style="filter:alpha(opacity=50)"onMouseUp="this.className='up'">
<div align=center>子菜单</div>
</td>
</tr>
<tr>
<td class=normal onMouseDown="this.className='down'"
onMouseOver="this.className='up',high(this)" onMouseOut="this.className='normal',low(this)" style="filter:alpha(opacity=50)"onMouseUp="this.className='up'">
<div align=center>子菜单</div>
</td>
</tr>
<tr>
<td class=normal onMouseDown="this.className='down'"
onMouseOver="this.className='up',high(this)" onMouseOut="this.className='normal',low(this)" style="filter:alpha(opacity=50)"onMouseUp="this.className='up'">
<div align=center>子菜单</div>
</td>
</tr>
</table>
</div>
<div id="menu2" style="position:absolute;top:45px;left:96; z-index:1; visibility: hidden; width: 105"
onMouseOver=this.style.visibility='visible'
onMouseOut=this.style.visibility='hidden' class="menuv">
<table cellspacing=2 width=100 border=0 style="BORDER:#999999 1px solid;cursor:hand" cellpadding="0" bgcolor="f4f4f4" align="right">
<tr>
<td class=normal onMouseDown="this.className='down'"
onMouseOver="this.className='up',high(this)" onMouseOut="this.className='normal',low(this)" style="filter:alpha(opacity=50)"onMouseUp="this.className='up'">
<div align="center">子菜单</div>
</td>
</tr>
<tr>
<td class=normal onMouseDown="this.className='down'"
onMouseOver="this.className='up',high(this)" onMouseOut="this.className='normal',low(this)" style="filter:alpha(opacity=50)"onMouseUp="this.className='up'">
<div align=center>子菜单</div>
</td>
</tr>
<tr>
<td class=normal onMouseDown="this.className='down'"
onMouseOver="this.className='up',high(this)" onMouseOut="this.className='normal',low(this)" style="filter:alpha(opacity=50)"onMouseUp="this.className='up'">
<div align=center>子菜单</div>
</td>
</tr>
<tr>
<td class=normal onMouseDown="this.className='down'"
onMouseOver="this.className='up',high(this)" onMouseOut="this.className='normal',low(this)" style="filter:alpha(opacity=50)"onMouseUp="this.className='up'">
<div align=center>子菜单</div>
</td>
</tr>
</table>
</div>
</div>
</body>
</html>

用javascript封装的导航菜单
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Phenix PanelBar</title>
<script language="javascript">
/*--------------------------------------------------|
| Phenix PanelBar | www.seu.edu.cn                  |
|---------------------------------------------------|
|                                                   |
|  I believe one day I can fly like phenix!         |
|                                                   |
| Finished: 17.11.2004                              |
|--------------------------------------------------*/

//item object
//alert("arrived here");
function PhenItem(id,pid,label,url,type,img,over,img2,over2,title,target){
   
   this.id=id;
   this.pid=pid;
   this.label=label;
   this.url=url;
   this.title=title;
   this.target=target;
   this.img=img;
   this.over=over;
   this.img2=img2;
   this.over2=over2;
   this.type=type;
   //this._ih = false;    //is it the head item?
   this._hc = false;   //has the child item?
   this._ls = false;    //has sibling item?
   this._io = false;    //whether the panelbar is open?
};


//menu object
function PhenMenu(objName) {

    this.config = {

        closeSameLevel    : true

    };
    //alert("asdsdf");
    this.obj = objName;

    this.items = [];
   
    this.root = new PhenItem(-1);
       
};

//add a new item to the item array
PhenMenu.prototype.add = function(id,pid,label,url,type,img,over,img2,over2,title,target){
    this.items[this.items.length] = new PhenItem(id,pid,label,url,type,img,over,img2,over2,title,target);
};

// Outputs the menu to the page
PhenMenu.prototype.toString = function() {
    //alert("arrived here");
    var str = '<div>\n';

    if (document.getElementById) {

        str += this.addItem(this.root);

    } else str += 'Browser not supported.';

    str += '\n</div>';
    //alert(str);
    //document.write(str);
    //alert(this.items[0]._hc);
    return str;

};

// Creates the menu structure
PhenMenu.prototype.addItem = function(pItem) {

    var str = '';

    //var n=0;

    for (var n=0; n<this.items.length; n++) {
       
        if(this.items[n].pid == pItem.id){
           
            var ci = this.items[n];
            //alert(ci.pid);
            //alert(ci.id);
            this.setHS(ci);
            //alert("item:"+ci._hc);
            //alert(ci._ls);
            str += this.itemCreate(ci, n);
           
            if(ci._ls) break;
           
        }

    }

    return str;

};

// Creates the node icon, url and text
PhenMenu.prototype.itemCreate = function(pItem, itemId) {
//alert(pItem.type.toLowerCase());
    var str = '';
   
    if(pItem.type == 'header')
        str = '<table width="100%" class="header" valign="middle" onmouseover="this.className=\'headerSelected\'" onmouseout="this.className=\'header\'" onclick="'+this.obj+'.o('+itemId+')"><tr><td>';

    else
        str = '<table width="100%" class="item" valign="middle" onmouseover="this.className=\'itemOver\'" onmouseout="this.className=\'item\'" onclick="'+this.obj+'.o('+itemId+')"><tr><td>';

    if (pItem.img) {

        str += '&nbsp;&nbsp;<img id="i' + this.obj + itemId + '" src="' + pItem.img + '" alt="" />';

    }
    if (pItem.url) {
        str += '<a id="s' + this.obj + itemId + '" class="navigation_item" href="' + pItem.url + '"';
        if (pItem.title) str += ' title="' + pItem.title + '"';
        if (pItem.target) str += ' target="' + pItem.target + '"';
        str += ' onmouseover="window.status=\'' + pItem.label + '\';return true;" onmouseout="window.status=\'\';return true;"';
        str += '>';
    }
    str += '&nbsp;' + pItem.label;
    if (pItem.url) str += '</a>';
    str += '</td></tr></table>';
    //alert(pItem.url);
    //alert(str);
    if (pItem._hc) {
        str += '<table id="ct' + this.obj + itemId + '" width="100%" style="display:' + ((pItem._io) ? 'block' : 'none') + '; FILTER: blendTrans(Duration=1.0); VISIBILITY: hidden"><tr><td>';
        str += this.addItem(pItem);
        str += '</td></tr></table>';
        //alert(str);
        //document.write(str);
    }

    return str;
};


// Checks whether a item has child and if it is the last sibling
PhenMenu.prototype.setHS = function(pItem) {

    var lastId;

    for (var n=0; n<this.items.length; n++) {

        if (this.items[n].pid == pItem.id) pItem._hc = true;

        if (this.items[n].pid == pItem.pid) lastId = this.items[n].id;

    }

    if (lastId==pItem.id) pItem._ls = true;

};

// Toggle Open or close
PhenMenu.prototype.o = function(id) {
    //alert(this.items.length);
    var ci = this.items[id];
    //alert(ci);
    //this.setHS(ci);
    //alert(this.items[id]._hc);
    this.itemStatus(!ci._io, id);

    ci._io = !ci._io;
   
    if (this.config.closeSameLevel) this.closeLevel(ci);

};

// Change the status of a item(open or closed)
PhenMenu.prototype.itemStatus = function(status, id) {

    cTable    = document.getElementById('ct' + this.obj + id);

    if(status){
           
        cTable.filters.item(0).Apply();
        cTable.style.display = 'block';
        cTable.style.visibility = "";
        cTable.filters.item(0).Play();
    }
    else
        cTable.style.display = 'none';
   
    //cDiv.style.display = (status) ? 'block': 'none';

};

// Closes all items on the same level as certain item
PhenMenu.prototype.closeLevel = function(pItem) {
               //alert(this.items[0]._hc);
    for (var n=0; n<this.items.length; n++) {
            //alert(this.items[n]._hc);
        if ((this.items[n].pid == pItem.pid) && (this.items[n].id != pItem.id) && this.items[n]._hc) {
           
            this.itemStatus(false, n);

            this.items[n]._io = false;

            this.closeAllChildren(this.items[n]);

        }

    }

};

PhenMenu.prototype.closeAllChildren = function(pItem) {

    for (var n=0; n<this.items.length; n++) {

        if (this.items[n].pid == pItem.id && this.items[n]._hc) {

            if (this.items[n]._io) this.itemStatus(false, n);

            this.items[n]._io = false;

            this.closeAllChildren(this.items[n]);       

        }

    }

};
</script>
<style>
.header {
    height:25px;
    FONT-FAMILY: Arial,Verdana;
    background-image:url(images/sideNavCategoryBg.gif);
    font-size:11px;
    color: #666666;
   
}
.headerSelected {   
    height:25px;
    FONT-FAMILY: Arial,Verdana;
    background-image:url(images/sideNavCategorySelectedBg.gif);
    font-size:11px;
    background-repeat:repeat-x;
    COLOR: #333333;
    CURSOR: pointer;
}

.navigation_item {
    PADDING-LEFT: 20px; FONT-SIZE: 11px; CURSOR: pointer; COLOR: #000000; FONT-FAMILY: Arial,Verdana; HEIGHT: 20px; TEXT-DECORATION: none
}
.item {
    PADDING-LEFT: 2px; FONT-SIZE: 11px; CURSOR: pointer; COLOR: #000000; FONT-FAMILY: Arial,Verdana; HEIGHT: 20px;
}
.itemOver {
    PADDING-LEFT: 2px; FONT-SIZE: 11px; CURSOR: pointer; COLOR: #333333; FONT-FAMILY: Arial,Verdana; HEIGHT: 20px; font-weight:bold; background-color:#EDEDED
}
.itemSelected {
    PADDING-LEFT: 20px; FONT-SIZE: 11px; CURSOR: pointer; COLOR: #000000; FONT-FAMILY: Arial,Verdana; HEIGHT: 20px; TEXT-DECORATION: underline;
}

A.headerSelected {
    PADDING-RIGHT: 0px; PADDING-LEFT: 0px; BACKGROUND-IMAGE: none; PADDING-BOTTOM: 0px; PADDING-TOP: 0px; HEIGHT: 10px
}
</style>
</head>
<body>
<table width="221" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td>
    <p>Phenix panelbar</p>

    <script type="text/javascript">

        p = new PhenMenu('p');
        //alert("asds");
        p.add(0,-1,'menu1','','header','squareplus.gif');
        p.add(1,0,'menu1.1','www.sina.com.cn');
        p.add(2,0,'menu1.2','');
        p.add(3,0,'menu1.3','');
        p.add(4,0,'menu1.4','');
       
        p.add(5,-1,'menu2','','header','squareplus.gif');
        p.add(6,5,'menu2.1','');
        p.add(7,5,'menu2.2','');
        p.add(8,5,'menu2.3','');
        p.add(9,5,'menu2.4','');
       
        p.add(10,-1,'menu3','','header','squareplus.gif');
        p.add(11,10,'menu3.1','');
        p.add(12,10,'menu3.2','');
        p.add(13,10,'menu3.3','');
        p.add(14,10,'menu3.4','');
       
        p.add(15,-1,'menu4','','header','squareplus.gif');
        p.add(16,15,'menu4.1','');
        p.add(17,15,'menu4.2','');
        p.add(18,15,'menu4.3','');
        p.add(19,15,'menu4.4','');
        //alert(p.items.length)
        document.write(p);
       
        //p.toString();
        //alert(p.items.length);
        //delete(p);
    </script>    </td>
  </tr>
</table>
</body>
</html>

黑夜博客gziu.com——CSS+DIV实现的滑动门菜单特效代码
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtm ... l.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>黑夜博客gziu.com——CSS+DIV实现的滑动门菜单特效代码</title>
<style type="text/css">
#menu {
  margin:0;
  padding:0;
  height:26em;
  overflow:hidden;
  background:#FFFCF2;
  }
#menu li {
  list-style-type:none;
  float:left;
  display:block;
  width:100%;
  }
#menu li a {
  display:block;
  text-decoration:none;
  color:#00b;
  margin:0;
  width:100%;
  }
#menu li a span {
  display:none;
  color:#453739;
  font-family: Verdana, Arial, Helvetica, sans-serif;
  font-size: 12px;
  padding: 10px 0px 5px;
  }
#menu li a.one span {
  display:block;
  height:15em;
  margin:0 10px;
  }
#menu li a:hover {
  background:#FFFCF2;
  }
#menu li a:hover span {
  display:block;
  height:5em;
  margin:0 10px;
  cursor:pointer;
  }
#menu .h2 {
  margin:0 5px;
  padding:0;
  color:#933A34;
  font-size:12px;
  border:0;
  font-family: Verdana, Arial, Helvetica, sans-serif;
  }
#menu .h3 {
  margin:0 5px;
  padding:0;
  font-size:10px;
  color:#62583B;
  font-family: Verdana, Arial, Helvetica, sans-serif;
  }
#menu img {
  margin:0px 5px 5px;
  border:0px solid #000;
  float:left;
  }
.curved {
  width:21em;
  }
.curved .b1, .curved .b2, .curved .b3, .curved .b4 {
  font-size:1px;
  display:block;
  background:#C7BC98;
/* hide overflow:hidden from IE5/Mac */
/* */
overflow: hidden;
/* */
}
.curved .b1, .curved .b2, .curved .b3 {
  height:1px;
  }
.curved .b2, .curved .b3, .curved .b4 {
  background:#FFFCF2;
  border-left:1px solid #C7BC98;
  border-right:1px solid #C7BC98;
  }
.curved .b1 {
  margin:0 4px;
  background:#C7BC98;
  }
.curved .b2 {
  margin:0 2px;
  border-width:0 2px;
  }
.curved .b3 {
  margin:0 1px;
  }
.curved .b4 {
  height:2px;
  margin:0;
  }
.curved .c1 {
  margin:0 5px;
  background:#C7BC98;
  }
.curved .c2 {
  margin:0 3px;
  border-width:0 2px;
  }
.curved .c3 {
  margin:0 2px;
  }
.curved .c4 {
  height:2px;
  margin: 0 1px;
  }
.curved .boxcontent {
  display:block;
  background:transparent;
  border-left:1px solid #C7BC98;
  border-right:1px solid #C7BC98;
  font-size:0.9em;
  text-align:justify;
  }
</style>
</head>

<body>
<div class="curved">
 <b class="b1 c1"></b>
 <b class="b2 c2"></b>
 <b class="b3 c3"></b>
 <b class="b4 c4"></b>
  <div class="boxcontent">
  <ul id="menu">
   <li>
   <a href="http://www.gziu.com">
    <b class="h2">黑夜博客</b><br />
    <b class="h3">[2007-05-16]</b>
    <span>
    <img src="hline.gif" />
    黑夜博客gziu.com,网页设计,网站制作建设,css学习,网页标准化 ?
    </span>
   </a>
   </li>
   <li>
   <a href="http://www.gziu.com">
    <b class="b1"></b>
    <b class="b2"></b>
    <b class="b3"></b>
    <b class="b4"></b>
    <b class="h2">网络技术</b><br />
    <b class="h3">[2007-05-16]</b>
    <span>
    <img src="hline.gif" />
    黑夜博客gziu.com,网页设计,网站制作建设,css学习,网页标准化
    </span>
   </a>
   </li>
   <li>
   <a href="http://www.gziu.com">
    <b class="b1"></b>
    <b class="b2"></b>
    <b class="b3"></b>
    <b class="b4"></b>
    <b class="h2">代码特效</b><br />
    <b class="h3">[2006-06-18]</b>
    <span>
    <img src="hline.gif" />
    黑夜博客gziu.com,网页设计,网站制作建设,css学习,网页标准化
    </span>
   </a>
   </li>
   <li>
   <a href="http://www.gziu.com">
    <b class="b1"></b>
    <b class="b2"></b>
    <b class="b3"></b>
    <b class="b4"></b>
    <b class="h2">程序开发</b><br />
    <b class="h3">[2007-05-16]</b>
    <span>
    <img src="hline.gif" />
    黑夜博客gziu.com,网页设计,网站制作建设,css学习,网页标准化
    </span>
   </a>
   </li>
   <li>
   <a class="one" href="http://www.gziu.com">
    <b class="b1"></b>
    <b class="b2"></b>
    <b class="b3"></b>
    <b class="b4"></b>
    <b class="h2">平面设计</b><br />
    <b class="h3">[2007-05-16]</b>
    <span>
    <img src="hline.gif" />
    黑夜博客gziu.com,网页设计,网站制作建设,css学习,网页标准化
    </span>
   </a>
   </li>
  </ul>
  </div>
 <b class="b4 c4"></b>
 <b class="b3 c3"></b>
 <b class="b2 c2"></b>
 <b class="b1 c1"></b>
</div>
</body>
</html>

posted on 2007-06-30 22:35  ms_dos  阅读(374)  评论(0编辑  收藏  举报