poche 发表于 2007-4-27 10:08:35

***页面导航***下拉菜单的导航条。

把下列代码加到网页的<body></body>标签之间 从google下载我的照片管理软件
<html>
<head>
<title>无标题文档</title>
<meta http-equiv="content-type" content="text/html; charset=gb2312">
<script language=javascript>
<!--

function mm_gotourl() { //v3.0
var i, args=mm_gotourl.arguments; document.mm_returnvalue = false;
for (i=0; i<(args.length-1); i+=2) eval(args+".location='"+args+"'");
}
function jm_cc(ob){
var obj=mm_findobj(ob); if (obj) {
obj.select();js=obj.createtextrange();js.execcommand("copy");}
}

function mm_findobj(n, d) { //v4.0
var p,i,x;if(!d) d=document; if((p=n.indexof("?"))>0&&parent.frames.length) {
    d=parent.frames.document; n=n.substring(0,p);}
if(!(x=d)&&d.all) x=d.all; for (i=0;!x&&i<d.forms.length;i++) x=d.forms;
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=mm_findobj(n,d.layers.document);
if(!x && document.getelementbyid) x=document.getelementbyid(n); return x;
}
//-->
</script>
<script language=javascript>
<!--

menuprefix = 'menu';// prefix that all menu layers must start with
                      // all layers with this prefix will be treated
                      // as a part of the menu system.

var menutree, mousemenu, hidetimer, dohide;

function init() {
ie4 = (document.all)?true:false;
ns4 = (document.layers)?true:false;
document.onmousemove = mousemove;
if (ns4) { document.captureevents(event.mousemove); }
}

function expandmenu(menucontainer,subcontainer,menuleft,menutop) {
    // hide all submenus thats's not below the current level
    dohide = false;
if (menucontainer != menutree) {
      if (ie4) {
      var menulayers = document.all.tags("div");
      for (i=0; i<menulayers.length; i++) {
      if ((menulayers.id.indexof(menucontainer) != -1) && (menulayers.id != menucontainer)) {
          hideobject(menulayers.id);
      }
      }
    }
    else if (ns4) {
      for (i=0; i<document.layers.length; i++) {
      var menulayer = document.layers;
      if ((menulayer.id.indexof(menucontainer) != -1) && (menulayer.id != menucontainer)) {
          menulayer.visibility = "hide";
      }
      }
    }
}
// if this is item has a submenu, display it, or it it's a toplevel menu, open it
if (subcontainer) {
    if ((menuleft) && (menutop)) {
      positionobject(subcontainer,menuleft,menutop);
      hideall();
    }
    else {
      if (ie4) {
          positionobject(subcontainer, document.all.offsetwidth + document.all.style.pixelleft - 10, mousey);
      }
      else {
          positionobject(subcontainer, document.layers.document.width + document.layers.left + 50, mousey);
      }
    }
    showobject(subcontainer);
    menutree = subcontainer;
}
}

function showobject(obj) {
if (ie4) { document.all.style.visibility = "visible"; }
else if (ns4) { document.layers.visibility = "show";}
}

function hideobject(obj) {
if (ie4) { document.all.style.visibility = "hidden"; }
else if (ns4) { document.layers.visibility = "hide"; }
}

function positionobject(obj,x,y) {
if (ie4) {
    var foo = document.all.style;
    foo.left = x;
    foo.top = y;
}
else if (ns4) {
    var foo = document.layers;
    foo.left = x;
    foo.top = y;
   }
}

function hideall() {
if (ie4) {
    var menulayers = document.all.tags("div");
    for (i=0; i<menulayers.length; i++) {
      if (menulayers.id.indexof(menuprefix) != -1) {
      hideobject(menulayers.id);
      }
    }
}
else if (ns4) {
    for (i=0; i<document.layers.length; i++) {
      var menulayer = document.layers;
      if (menulayer.id.indexof(menuprefix) != -1) {
      hideobject(menulayer.id);
      }
    }
}
}

function hideme(hide) {
    if (hide) {
      if (dohide) { hideall(); }
    }
    else {
      dohide = true;
      hidetimer = window.settimeout("hideme(true);", 2000);

    }
}

function mousemove(e) {
if (ie4) { mousey = window.event.y; }
if (ns4) { mousey = e.pagey; }
}

function itemhover(obj,src,text,style) {
if (ns4) {
    var text = '<nobr><a href="' + src + '" class="' + style + '">' + text + '<\/a><\/nobr>'
    obj.document.open();
    obj.document.write(text);
    obj.document.close();
}
}

onload = init;
//-->
</script>
<style type=text/css>
<!--
.menu                   { position: absolute; left: 0; top: 2;
                           visibility: hidden; background: #ffffff;
                           width: 100px; margin: 0px 0px; padding: 0px 0px;
                           border: 1px silver solid;
                           overflow: visible; ; clip:   rect(   )}
.menu a:visited { font-family: "tahoma"; font-size: 11px;
                           text-decoration: none; font-weight: normal;
                           color: black; background: #e2e2e2;
                           width: 108px; padding-left: 8px; ; line-height: 22px; border-color: #ffffff #666666 #333333 #999999; border-style: solid; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; clip:rect(   )}
.menu a:hover            { font-family: "tahoma"; font-size: 11px;
                           text-decoration: none; font-weight: normal;
                           color: #ffffff; background: #009900;
                           width: 108px; padding-left: 8px; ; line-height: 22px; clip:rect(   )}
.menu .border            { border: 1px solid #f4f4f4;
                           border-bottom: 1px solid #808080;
                           border-right: 1px solid #808080; }
.menu .text            { overflow: hidden;
                           width: 125px; height: 15px; }
.menu .arrow             { overflow: hidden;
                           width: 15px; height: 12px;
                           padding-left: 5px; padding-top: 3px; }
.menu .arrow img         { width: 6px; height: 7px;
                           border: 0px; }.menu a { font-family: "tahoma"; font-size: 11px;
                           text-decoration: none; font-weight: normal;
                           color: black; background: #e2e2e2;
                           width: 108px; padding-left: 8px;; clip:rect(   ); border-color: #ffffff #666666 #333333 #999999; border-style: solid; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; line-height: 22px} .menu a:link {color: #000000; text-decoration: none}

.a {font-size: 12px; text-decoration: none}
a:link {color: #ffffff; text-decoration: none}
a:hover {text-decoration: underline}
a:visited {color: #ffffff; text-decoration: none}
-->
</style>
</head>

<body bgcolor="#ffffff" text="#000000" leftmargin="0" topmargin="0">
<table border="0" cellpadding="0" cellspacing="1" bgcolor="#333333" width="778" class="a">
<tr bgcolor="#009830" align="center" valign="bottom">
    <td width="10" height="18"> </td>
    <td width="74"><a href="#;"onmouseover="expandmenu(null,'menu1',getpos(this,'left'),getpos(this,'top')+this.offsetheight);" class="a" >第一项</a></td>
    <td width="58"><a href="#;"onmouseover="expandmenu(null,'menu2',getpos(this,'left'),getpos(this,'top')+this.offsetheight);" class="a" >第二项</a></td>
    <td width="58"><a href="#;"onmouseover="expandmenu(null,'menu3',getpos(this,'left'),getpos(this,'top')+this.offsetheight);" class="a" >第三项</a></td>
    <!--可以复制上面的做出menu4 menu5 menu6....-->
    <td width="40"><a href="#;" class="a" >首页</a></td>
    <td width="18" height="18"> </td>
</tr>
</table>
<script language="javascript">
function getpos(el,sprop) {
    var ipos = 0
    while (el!=null) {
      ipos+=el["offset" + sprop]
      el = el.offsetparent
    }
    return ipos

}
</script>
<!-- 第一开始 -->
<div id="menu1" class="menu" onmouseout="hideme();" style="">
<a href="#;" onmouseover="expandmenu('menu1');">第一项</a><br>
<a href="#;" onmouseover="expandmenu('menu1');">第一项</a><br>
<a href="#;" onmouseover="expandmenu('menu1');">第一项</a><br>
<a href="#;" onmouseover="expandmenu('menu1');">第一项</a><br>
</div>
<!-- 第二开始 -->
<div id="menu2" class="menu" onmouseout="hideme();">
<a href="#;" onmouseover="expandmenu('menu2');">第二项</a><br>
<a href="#;" onmouseover="expandmenu('menu2');">第二项</a><br>
<a href="#;" onmouseover="expandmenu('menu2');">第二项</a><br>
<a href="#;" onmouseover="expandmenu('menu2');">第二项</a><br>
</div>
<!-- 第三开始 -->
<div id="menu3" class="menu" onmouseout="hideme();">
<a href="#;" onmouseover="expandmenu('menu3');">第三项</a><br>
<a href="#;" onmouseover="expandmenu('menu3');">第三项</a><br>
<a href="#;" onmouseover="expandmenu('menu3');">第三项</a><br>
<a href="#;" onmouseover="expandmenu('menu3');">第三项</a><br>
</div>
<!--可以复制上面的做出menu4 menu5 menu6....-->
<p class="a"> </p>
</body>
</html>

      










--------------------------------------

http://www.huoyue.com.cn 活跃网,活跃人群的论坛,访问活跃网,将给您带来意想不到的收获,还可以免费为您开论坛,让您免费拥有与朋友、网友交流的论坛。你是年轻人吗?你活跃你就上!
页: [1]
查看完整版本: ***页面导航***下拉菜单的导航条。