JS+CSS實(shí)現(xiàn)仿msn風(fēng)格選項(xiàng)卡效果代碼
本文實(shí)例講述了JS+CSS實(shí)現(xiàn)仿msn風(fēng)格選項(xiàng)卡效果代碼。分享給大家供大家參考,具體如下:
這是一款來自MSN網(wǎng)站的選項(xiàng)卡,清新淡藍(lán)色風(fēng)格,新聞?lì)?、資訊類、文章類網(wǎng)站都比較適合使用,代碼擴(kuò)展性高,W3C標(biāo)準(zhǔn)設(shè)計(jì),兼容IE、火狐等多種瀏覽器,整體效果非常不錯(cuò)。
運(yùn)行效果截圖如下:

在線演示地址如下:
http://demo.jb51.net/js/2015/js-css-f-msn-style-menu-demo/
具體代碼如下:
<!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>msn 選項(xiàng)卡</title>
<style type="text/css">
body {text-align:center;color:#666;font-size:12px;font-family:tahoma,arial,sans-serif;}
h1, h2, h3, h4, h5, h6, form, div, p, i, img, ul, li, ol, table, tr, td,th, fieldset, label, legend,button,input { margin:0;padding:0;}
li{list-style:none;}
a img{border:none;}
a:link{text-decoration:none;color:#07519A;}
a:visited{text-decoration:none;color:#07519A;}
a:active,a:hover{text-decoration:underline;color:#07519A;}
.tarea0{float:left;height:220px;width:242px;}
.tarea{border:1px solid #ace;float:left;height:156px;text-align:center;width:242px;}
.tarea1{border:1px solid #ace;float:left;height:251px;text-align:center;width:242px;}
.tarea2{border:1px solid #ace;float:left;height:217px;text-align:center;width:243px;}
ul.tbtn li{background:#EBF3FB;border:1px solid #ace;border-left:none;border-top:none;color:#07519A;cursor:pointer;display:block;float:left;height:25px;line-height:25px;text-align:center;text-decoration:none;width:60px;background:url(images/msfp_015.gif) repeat-x;}
ul.tbtn li:hover{text-decoration:underline;}
ul.tbtn li.curr{background:#fff;border-bottom-color:#fff;cursor:default;color:#666;}
.tbcon{margin:8px 0px 6px 8px;text-align:left;padding:8px;}
</style>
<script language="javascript" type="text/javascript">
function tabit(btn){
var idname = new String(btn.id);
var s = idname.indexOf("_");
var e = idname.lastIndexOf("_")+1;
var tabName = idname.substr(0, s);
var id = parseInt(idname.substr(e, 1));
var tabNumber = btn.parentNode.childNodes.length;
for(i=0;i<tabNumber;i++){
document.getElementById(tabName+"_div_"+i).style.display = "none";
document.getElementById(tabName+"_btn_"+i).className = "";
};
document.getElementById(tabName+"_div_"+id).style.display = "block";
btn.className = "curr";
};
</script>
</head>
<body>
<div class="tarea2" style="height:223px;">
<ul class="tbtn">
<li onclick="tabit(this)" id="tabap1_btn_0" class="curr">最新上傳</li>
<li onclick="tabit(this)" id="tabap1_btn_1">分類導(dǎo)航</li>
<li onclick="tabit(this)" id="tabap1_btn_2">網(wǎng)頁特效</li>
<li style="border-right:none;" onclick="tabit(this)" id="tabap1_btn_3">瀏覽排行</li>
</ul>
<div class="clr"></div>
<div class="tbcon" id="tabap1_div_0">這里是最新上傳的內(nèi)容</div>
<div style="display: none;" class="tbcon" id="tabap1_div_1">這里是分類導(dǎo)航</div>
<div style="display: none;" class="tbcon" id="tabap1_div_2">網(wǎng)頁特效的內(nèi)容</div>
<div style="display: none;" class="tbcon" id="tabap1_div_3">瀏覽排行</div>
</div>
</body>
</html>
希望本文所述對(duì)大家JavaScript程序設(shè)計(jì)有所幫助。
- JS實(shí)現(xiàn)的最簡Table選項(xiàng)卡效果
- JS+CSS實(shí)現(xiàn)的藍(lán)色table選項(xiàng)卡效果
- JS+CSS實(shí)現(xiàn)的日本門戶網(wǎng)站經(jīng)典選項(xiàng)卡導(dǎo)航效果
- JS實(shí)現(xiàn)橫向與豎向兩個(gè)選項(xiàng)卡Tab聯(lián)動(dòng)的方法
- JS實(shí)現(xiàn)滑動(dòng)菜單效果代碼(包括Tab,選項(xiàng)卡,橫向等效果)
- JS基于myFocus庫實(shí)現(xiàn)各種功能的tab選項(xiàng)卡切換效果
- JS實(shí)現(xiàn)的不規(guī)則TAB選項(xiàng)卡效果代碼
- JS+CSS實(shí)現(xiàn)的經(jīng)典tab選項(xiàng)卡效果代碼
- JS實(shí)現(xiàn)不規(guī)則TAB選項(xiàng)卡效果代碼
- JS+CSS實(shí)現(xiàn)自適應(yīng)選項(xiàng)卡寬度的圓角滑動(dòng)門效果
- JS實(shí)現(xiàn)選項(xiàng)卡實(shí)例詳解
相關(guān)文章
深入理解JavaScript是如何實(shí)現(xiàn)繼承的
這篇文章主要介紹了JavaScript是如何實(shí)現(xiàn)繼承的,有需要的朋友可以參考一下2013-12-12
javascript監(jiān)聽鼠標(biāo)滾輪事件淺析
這篇文章主要介紹了javascript監(jiān)聽鼠標(biāo)滾輪事件淺析,使用具體例子說明,同時(shí)考慮了不同的瀏覽器,需要的朋友可以參考下2014-06-06
通用于ie和firefox的函數(shù) GetCurrentStyle (obj, prop)
通用于ie和firefox的函數(shù) GetCurrentStyle (obj, prop)...2006-12-12
利用d3.js實(shí)現(xiàn)蜂巢圖表帶動(dòng)畫效果
這篇文章主要給大家介紹了關(guān)于如何利用d3.js實(shí)現(xiàn)蜂巢圖表帶動(dòng)畫效果的相關(guān)資料,文中通過示例代碼介紹的非常詳細(xì),對(duì)大家學(xué)習(xí)或者使用d3.js具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面來一起學(xué)習(xí)學(xué)習(xí)吧2019-09-09
動(dòng)態(tài)加載js文件 document.createElement
動(dòng)態(tài)加載js文件 document.createElement...2006-10-10
JavaScript 節(jié)流函數(shù) Throttle 詳解
這篇文章主要為大家詳細(xì)介紹了JavaScript 節(jié)流函數(shù) Throttle,感興趣的小伙伴們可以參考一下2016-07-07
javascript跨域總結(jié)之window.name實(shí)現(xiàn)的跨域數(shù)據(jù)傳輸
本文給大家介紹window.name實(shí)現(xiàn)的跨域數(shù)據(jù)傳輸,自己親自實(shí)踐了一下,真的非常好用,特此分享到腳本之家網(wǎng)站供大家參考2015-11-11
js實(shí)現(xiàn)七夕表白彈幕效果 jQuery實(shí)現(xiàn)彈幕技術(shù)
這篇文章主要介紹了js實(shí)現(xiàn)七夕表白彈幕效果,jQuery實(shí)現(xiàn)彈幕技術(shù),文中示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下2021-08-08

