CSS+DIV+Javascript製作滑動門菜單技術

來源:互聯網
上載者:User
css|javascript|菜單

<style>body {font-size:12px;font-family:宋體}ul.TabBarLevel1{list-style:none;margin:0;padding:0;height:29px;background-image:url(20060409082237_tabbar_level1_bk.gif);}ul.TabBarLevel1 li{float:left;padding:0;height:29px;margin-right:1px;background:url(20060409082248_tabbar_level1_slice_left_bk.gif) left top no-repeat;}ul.TabBarLevel1 li a{display:block;line-height:29px;padding:0 20px;color:#333;background:url(20060409082257_tabbar_level1_slice_right_bk.gif) right top no-repeat;white-space: nowrap;}ul.TabBarLevel1 li.Selected{background:url(20060409082312_tabbar_level1_slice_selected_left_bk.gif) left top no-repeat;}ul.TabBarLevel1 li.Selected a{background:url(20060409082323_tabbar_level1_slice_selected_right_bk.gif) right top no-repeat;}ul.TabBarLevel1 li a:link,ul.TabBarLevel1 li a:visited{color:#333;}ul.TabBarLevel1 li a:hover,ul.TabBarLevel1 li a:active{color:#F30;text-decoration:none;}ul.TabBarLevel1 li.Selected a:link,ul.TabBarLevel1 li.Selected a:visited{color:#000;}ul.TabBarLevel1 li.Selected a:hover,ul.TabBarLevel1 li.Selected a:active{color:#F30;text-decoration:none;}div.HackBox { padding : 2px 2px ; border-left: 2px solid #6697CD; border-right: 2px solid #6697CD; border-bottom: 2px solid #6697CD; display:none;}</style><div id="Whatever"><ul class="TabBarLevel1" id="TabPage1"><li id="Tab1"><a href="#" >寶貝詳情</a></li><li id="Tab2" class="Selected"><a href="#" >其他資訊</a></li><li id="Tab3"><a href="#" >出價記錄</a></li><li id="Tab4"><a href="#" >留言簿</a></li></ul><div id="cnt"><div id="dTab1" class="HackBox">代碼如下: <!--這裡放入資訊--> 哈哈哈哈1</div><div id="dTab2" class="HackBox" style="display:block">代碼如下: <!--這裡放入資訊--> 哈哈哈哈2</div><div id="dTab3" class="HackBox">代碼如下: <!--這裡放入資訊--> 哈哈哈哈3</div><div id="dTab4" class="HackBox">代碼如下: <!--這裡放入資訊--> 哈哈哈哈4</div></div></div><script language="JavaScript">//Switch Tab Effectfunction switchTab(tabpage,tabid){ var oItem = document.getElementById(tabpage); for(var i=0;i<oItem.children.length;i++){var x = oItem.children(i);x.className = "";var y = x.getElementsByTagName('a');y[0].style.color="#333333";}document.getElementById(tabid).className = "Selected";var dvs=document.getElementById("cnt").getElementsByTagName("div");for (var i=0;i<dvs.length;i++){ if (dvs[i].id==('d'+tabid)) dvs[i].style.display='block'; else dvs[i].style.display='none';}}</script>

    [Ctrl+A 全部選擇 提示:你可先修改部分代碼,再按運行]



相關文章

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.