您的位置:IT在中国 >> 资源下载 >> 代码下载 >> 正文
| 以下是代码片段: <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312"> <style> BODY {font-size:9pt;color:white;background-color:yellow} TABLE{font-size:9pt;color:snow;background-color:darkblue;BORDER-COLLAPSE: collapse;text-align:center} DIV{font-size:9pt;color:springgreen;background-color:green} TD{cursor:hand} FONT {font-size:9pt;color:lime;cursor:hand} .over {color:gold;background-color:slateblue} .out{ color:snow;background-color:darkblue} </style> <script> function popmenu(obj1) { obj1.className="over"; menu1.style.backgroundColor="slateblue"; menu1.style.borderTopColor="slateblue"; menu1.style.top=obj1.offsetTop+obj1.offsetHeight; menu2.style.top=obj1.offsetTop+obj1.offsetHeight+10; menu1.style.left=obj1.offsetLeft+obj1.offsetWidth/2-40; menu2.style.left=obj1.offsetLeft+obj1.offsetWidth/2-30; menu1.style.display=""; menu2.style.display=""; } function menuout(obj1) { obj1.className="out"; menu1.style.backgroundColor="darkblue"; menu1.style.borderTopColor="darkblue"; } function menuclear() { if (event.toElement.tagName!="FONT") { menu1.style.display='none'; menu2.style.display='none'; } } function hide() {menu1.style.display='none';menu2.style.display='none';} </script> <title>不错的下拉菜单</title> </head> <body topmargin="0" leftmargin="0" onResize="location.reload()"> <script> for(x=0;x<=document.body.offsetWidth;x+=10){ document.write("<div style='position:absolute;left:"+x+";top:0;height:100%;width:1;font-size:1pt;background-color:gray;border:0;z-index:-2'></div>") } for(x=0;x<=document.body.offsetHeight;x+=10) { document.write("<div style='position:absolute;left:0;top:"+x+";height:1;width:100%;font-size:1pt;background-color:gray;border:0;z-index:-2'></div>") } </script> <div id=menu1 onMouseOut="menuclear()" style="position:absolute;text-align:center;color:snow;background-color:slateblue;top:100;left:100;height:200;width:80;display:none;border-style:solid;border-width:1;border-color:cyan;border-top-color:slateblue;z-index:1"> <br> <script> for(x=0;x<11;x++){document.write("<font onmouseover=this.style.color='red' onmouseout=this.style.color='lime'>子菜单一</font><br>");} </script> </div> <div id=menu2 style="position:absolute;Filter:Alpha(opacity=40);background-color:black;height:200;width:80;z-index:-1;display:none"></div> <table border="1" cellspacing="1" width="100%" bordercolor="#00FFFF" style="position: absolute; top: 0" > <tr> <td width="16%" onMouseOver="popmenu(this)" onMouseOut="menuout(this)" onClick="menu1.style.display='none';menu2.style.display='none'" >主页</td> <td width="16%" onMouseOver="popmenu(this)" onMouseOut="menuout(this)" onClick="menu1.style.display='none';menu2.style.display='none'">菜单一</td> <td width="17%" onMouseOver="popmenu(this)" onMouseOut="menuout(this)" onClick="menu1.style.display='none';menu2.style.display='none'">菜单二</td> <td width="17%" onMouseOver="popmenu(this)" onMouseOut="menuout(this)" onClick="menu1.style.display='none';menu2.style.display='none'">菜单三</td> <td width="17%" onMouseOver="popmenu(this)" onMouseOut="menuout(this)" onClick="menu1.style.display='none';menu2.style.display='none'">菜单四</td> <td width="17%" onMouseOver="popmenu(this)" onMouseOut="menuout(this)" onClick="menu1.style.display='none';menu2.style.display='none'">菜单五</td> </tr> </table> </body> </html> |