最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

JS+CSS實(shí)現(xiàn)簡(jiǎn)單的二級(jí)下拉導(dǎo)航菜單效果

 更新時(shí)間:2015年09月21日 10:01:08   作者:企鵝  
這篇文章主要介紹了JS+CSS實(shí)現(xiàn)簡(jiǎn)單的二級(jí)下拉導(dǎo)航菜單效果,通過簡(jiǎn)單的JavaScript頁面元素遍歷及樣式操作實(shí)現(xiàn)下拉菜單效果,非常簡(jiǎn)單實(shí)用,需要的朋友可以參考下

本文實(shí)例講述了JS+CSS實(shí)現(xiàn)簡(jiǎn)單的二級(jí)下拉導(dǎo)航菜單效果。分享給大家供大家參考。具體如下:

這是一款CSS配合JavaScript實(shí)現(xiàn)二級(jí)下拉導(dǎo)航菜單,好像CSS要配合JS才能寫出好效果來,本款菜單同樣用到了JS,菜單目前支持兩級(jí),下拉導(dǎo)航是我們經(jīng)常用的一種菜單形式,把這個(gè)修改一下你就能用了,結(jié)構(gòu)挺簡(jiǎn)單,相信你會(huì)做好的。

運(yùn)行效果截圖如下:

在線演示地址如下:

http://demo.jb51.net/js/2015/js-css-simple-2l-fade-down-menu-codes/

具體代碼如下:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>CSS二級(jí)下拉導(dǎo)航菜單</title>
<meta http-equiv="content-type" content="text/html;charset=gb2312">
<style type="text/css">
body,html{padding:0;margin:0;text-align:center;font:normal 14px 'arial';}
#mainNavBar{width:100%;background:#999;padding:10px 0;}
#nav{width:760px;height:30px;margin:0 auto;}
#nav ul{padding:0;margin:0;}
#nav ul li{position:relative;float:left;width:60px;height:30px;line-height:30px;overflow:hidden;list-style-type:none;}
#nav ul li a{display:block;color:#fff;text-decoration:none;}
#nav ul li a:hover{font-weight:bold;background:#666;}
#subNav{position:absolute;width:150px;top:30px;left:0px;padding:5px;background:#666;color:#fff;text-align:left;}
#subNav a{text-decoration:none;font-weight:normal;display:block;}
#subNav a:hover{color:#f00;background:#f00;}
</style>
</head>
<body>
<div id="mainNavBar">
 <div id="nav">
  <ul>
   <li>
    <a href="#">添加</a>
    <div id="subNav">
     <a href="#">日志</a>
     <a href="#">分類</a>
    </div>
   </li>
   <li>
    <a href="#">管理</a>
    <div id="subNav">
     <a href="#">分類</a>
     <a href="#">文章</a>
    </div>
   </li>
   <li>
    <a href="#">擴(kuò)展</a>
    <div id="subNav">
     <a href="#">評(píng)論管理</a>
     <a href="#">留言管理</a>
     <a href="#">注銷退出</a>
    </div>
   </li>
  </ul>
 </div>
</div>
<script language="javascript">
var nav=document.getElementById("nav").getElementsByTagName("li");
for(i=0;i<nav.length;i++){
nav[i].onmouseover=function(){
 this.style.fontWeight="bold";
 this.style.overflow="visible";
 this.style.background="#666666";
 }
nav[i].onmouseout=function(){
 this.style.fontWeight="normal";
 this.style.background="#999999"
 this.style.overflow="hidden";
 }
}
</script>
</body>
</html>

希望本文所述對(duì)大家的JavaScript程序設(shè)計(jì)有所幫助。

相關(guān)文章

最新評(píng)論

青海省| 武威市| 涡阳县| 尖扎县| 偏关县| 博湖县| 乐安县| 如东县| 丰台区| 洪洞县| 韶关市| 临沧市| 岐山县| 泊头市| 同德县| 广德县| 平塘县| 大埔县| 裕民县| 绥化市| 龙山县| 台中市| 山东省| 合山市| 庄浪县| 富阳市| 牡丹江市| 蓬安县| 达日县| 尼玛县| 南漳县| 丹江口市| 云和县| 临朐县| 白河县| 徐汇区| 五原县| 中江县| 文山县| 全椒县| 阆中市|