JS實現(xiàn)的不規(guī)則TAB選項卡效果代碼
更新時間:2015年09月18日 17:37:00 作者:企鵝
這篇文章主要介紹了JS實現(xiàn)的不規(guī)則TAB選項卡效果代碼,基于鼠標(biāo)事件動態(tài)設(shè)置頁面元素樣式實現(xiàn)該效果,具有一定參考借鑒價值,需要的朋友可以參考下
本文實例講述了JS實現(xiàn)的不規(guī)則TAB選項卡效果代碼。分享給大家供大家參考。具體如下:
這是一款采用菱形的選項卡效果,一改選項卡中規(guī)中矩的風(fēng)格,效果非常不錯,奉獻(xiàn)給大家。
運行效果截圖如下:

在線演示地址如下:
http://demo.jb51.net/js/2015/js-bgz-tab-cha-style-codes/
具體代碼如下:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>不規(guī)則TAB選項卡效果</title>
<style type="text/css">
<!--
body,td{font-size: 12px;}
.tab{margin-top:100px}
#TabTab03Con1{width:346px;height:100px;line-height:100px;border-left:#757575 1px solid;border-bottom:#757575 1px solid;border-right:#757575 1px solid;}
#TabTab03Con2{width:346px;height:100px;line-height:100px;border-left:#757575 1px solid;border-bottom:#757575 1px solid;border-right:#757575 1px solid;}
#TabTab03Con3{width:346px;height:100px;line-height:100px;border-left:#757575 1px solid;border-bottom:#757575 1px solid;border-right:#757575 1px solid;}
.xixi1{width:346px;height:27px;line-height:27px;background-image:url(images/tab01.jpg);cursor:pointer;}
.xixi2{width:346px;height:27px;line-height:27px;background-image:url(images/tab02.jpg);cursor:pointer;}
.xixi3{width:346px;height:27px;line-height:27px;background-image:url(images/tab03.jpg);cursor:pointer;}
.tab1{width:115px;height:27px;line-height:27px;float:left;text-align:center;cursor:pointer;}
.tab2{width:115px;height:27px;line-height:27px;float:left;text-align:center;cursor:pointer;color:#FFFFFF;}
.tab3{width:115px;height:27px;line-height:27px;float:left;text-align:center;cursor:pointer;color:#FFFFFF;}
-->
</style>
</head>
<body style="text-align:center">
<script type=text/javascript>
function setTab03Syn ( i )
{
selectTab03Syn(i);
}
function selectTab03Syn ( i )
{
switch(i){
case 1:
document.getElementById("TabTab03Con1").style.display="block";
document.getElementById("TabTab03Con2").style.display="none";
document.getElementById("TabTab03Con3").style.display="none";
document.getElementById("font1").style.color="#000000";
document.getElementById("font2").style.color="#ffffff";
document.getElementById("font3").style.color="#ffffff";
break;
case 2:
document.getElementById("TabTab03Con1").style.display="none";
document.getElementById("TabTab03Con2").style.display="block";
document.getElementById("TabTab03Con3").style.display="none";
document.getElementById("font1").style.color="#ffffff";
document.getElementById("font2").style.color="#000000";
document.getElementById("font3").style.color="#ffffff";
break;
case 3:
document.getElementById("TabTab03Con1").style.display="none";
document.getElementById("TabTab03Con2").style.display="none";
document.getElementById("TabTab03Con3").style.display="block";
document.getElementById("font1").style.color="#ffffff";
document.getElementById("font2").style.color="#ffffff";
document.getElementById("font3").style.color="#000000";
break;
}
}
</script>
<div class="tab">
<div id="bg" class="xixi1">
<div id="font1" class="tab1" onMouseOver="setTab03Syn(1);document.getElementById('bg').className='xixi1'">查詢廣告企業(yè)</div>
<div id="font2" class="tab2" onMouseOver="setTab03Syn(2);document.getElementById('bg').className='xixi2'">查詢媒體刊例</div>
<div id="font3" class="tab3" onMouseOver="setTab03Syn(3);document.getElementById('bg').className='xixi3'">查詢供求商情</div>
</div>
<div id=TabTab03Con1>不規(guī)則TAB選項卡效果</div>
<div id=TabTab03Con2 style="display:none">內(nèi)容2</div>
<div id=TabTab03Con3 style="display:none">內(nèi)容3</div>
</div>
</body>
</html>
希望本文所述對大家的JavaScript程序設(shè)計有所幫助。
您可能感興趣的文章:
- JS+CSS實現(xiàn)仿msn風(fēng)格選項卡效果代碼
- JS實現(xiàn)的最簡Table選項卡效果
- JS+CSS實現(xiàn)的藍(lán)色table選項卡效果
- JS+CSS實現(xiàn)的日本門戶網(wǎng)站經(jīng)典選項卡導(dǎo)航效果
- JS實現(xiàn)橫向與豎向兩個選項卡Tab聯(lián)動的方法
- JS實現(xiàn)滑動菜單效果代碼(包括Tab,選項卡,橫向等效果)
- JS基于myFocus庫實現(xiàn)各種功能的tab選項卡切換效果
- JS+CSS實現(xiàn)的經(jīng)典tab選項卡效果代碼
- JS實現(xiàn)不規(guī)則TAB選項卡效果代碼
- JS+CSS實現(xiàn)自適應(yīng)選項卡寬度的圓角滑動門效果
- JS實現(xiàn)選項卡實例詳解
相關(guān)文章
js實現(xiàn)網(wǎng)頁隨機(jī)切換背景圖片的方法
這篇文章主要介紹了js實現(xiàn)網(wǎng)頁隨機(jī)切換背景圖片的方法,涉及數(shù)組、隨機(jī)函數(shù)與css樣式的調(diào)用技巧,非常具有實用價值,需要的朋友可以參考下2014-11-11
javascript學(xué)習(xí)基礎(chǔ)筆記之DOM對象操作
javascript是一種基于對象和世界驅(qū)動,并且安全性較強(qiáng)的腳本語言。一個完整的javascript實現(xiàn)包括核心(ECMAScript),文檔對象模型(DOM)和瀏覽器對象模型(BOM)2011-11-11
js將iframe中控件的值傳到主頁面控件中的實現(xiàn)方法
主要是通過在主頁面定義一個傳輸數(shù)據(jù)的函數(shù)GetData(data),然后在iframe嵌入頁面中通過parent.GetData(data),這樣即可在GetData實現(xiàn)將data進(jìn)行處理即可。2013-03-03

