国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 開發 > JS > 正文

基于JavaScript實現TAB標簽效果

2024-05-06 16:27:43
字體:
來源:轉載
供稿:網友

 js實現tab標簽效果,在項目中經常用到,今天抽點時間把我寫的js實現tab標簽效果源碼分享給大家,對js tab標簽代碼需要的朋友參考下

廢話不多說了,直接給大家貼代碼了:

<html><head><meta http-equiv="Content-Type" content="text/html; charset=gb2312" /><meta name="keywords" content="JS代碼,TAB標簽,JS廣告代碼,JS特效代碼" /><meta name="description" content="此代碼內容為不規則TAB選項卡效果,屬于站長常用代碼,更多TAB標簽代碼請訪問VeVb武林網頻道。" /><title>TAB選項卡效果</title><style type="text/css"><!--body,td{font-size: 12px;}.tab{margin-top:100px}//定義三個id#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/01.jpg);cursor:pointer;}.xixi2{width:346px;height:27px;line-height:27px;background-image:url(images/02.jpg);cursor:pointer;}.xixi3{width:346px;height:27px;line-height:27px;background-image:url(images/03.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" onMouseDown="setTab03Syn(1);document.getElementById('bg').className='xixi1'">page1</div><div id="font2" class="tab2" onMouseDown="setTab03Syn(2);document.getElementById('bg').className='xixi2'">page2</div><div id="font3" class="tab3" onMouseDown="setTab03Syn(3);document.getElementById('bg').className='xixi3'">page3</div></div><div id=TabTab03Con1> 不規則TAB選項卡效果1</div><div id=TabTab03Con2 style="display:none">不規則TAB選項卡效果2</div><div id=TabTab03Con3 style="display:none">不規則TAB選項卡效果3</div></div></body></html>

以上代碼經小編測試過了,可以放心使用,當然要根據個人項目需求,適當的增刪改查,非常感謝大家對VeVb武林網網站的支持。


注:相關教程知識閱讀請移步到JavaScript/Ajax教程頻道。
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 龙川县| 玉门市| 阳新县| 保山市| 弥渡县| 新建县| 灵石县| 通山县| 且末县| 张家川| 呼图壁县| 凉城县| 宜兴市| 绥中县| 蒙阴县| 鸡东县| 宁津县| 秦安县| 和田县| 东源县| 绥棱县| 布尔津县| 潜江市| 黄陵县| 太谷县| 稷山县| 牡丹江市| 湘潭县| 宁乡县| 珠海市| 台山市| 南安市| 克东县| 额尔古纳市| 林甸县| 枝江市| 平塘县| 榆中县| 岑溪市| 永靖县| 镇康县|