js tab 選項(xiàng)卡
更新時(shí)間:2009年04月26日 14:16:40 作者:
選項(xiàng)卡的實(shí)現(xiàn)方法比較多,但原理基本上都差不多,隱藏與顯示輪換
一般需要事先寫好css樣式等
function tab(sId) {
var tabs = document.getElementsByTagName("H2");
var boxs = document.getElementsByTagName("h3");
if ( boxs[sId].style.display=="block"){
boxs[sId].style.display="none";
tabs[sId].style.backgroundColor="#E3F4FE";
tabs[sId].style.color="#000000";
}
else{
boxs[sId].style.display="block";
tabs[sId].style.backgroundColor="#3575CC";
tabs[sId].style.color="#ffffff";
}
for (var i=0; i<tabs.length; i++) {
if ( i != sId) {
boxs[i].style.display = "none";
tabs[i].style.backgroundColor="#E3F4FE";
tabs[i].style.color="#000000";
}
}
}
<h2 onclick="tab();">中英合作自考</h2>
<h3>
<ul>
<li></li>
</ul>
</h3>
</h2>
function tab(sId) {
var tabs = document.getElementsByTagName("H2");
var boxs = document.getElementsByTagName("h3");
if ( boxs[sId].style.display=="block"){
boxs[sId].style.display="none";
tabs[sId].style.backgroundColor="#E3F4FE";
tabs[sId].style.color="#000000";
}
else{
boxs[sId].style.display="block";
tabs[sId].style.backgroundColor="#3575CC";
tabs[sId].style.color="#ffffff";
}
for (var i=0; i<tabs.length; i++) {
if ( i != sId) {
boxs[i].style.display = "none";
tabs[i].style.backgroundColor="#E3F4FE";
tabs[i].style.color="#000000";
}
}
}
<h2 onclick="tab();">中英合作自考</h2>
<h3>
<ul>
<li></li>
</ul>
</h3>
</h2>
您可能感興趣的文章:
- javascript實(shí)現(xiàn)tabs選項(xiàng)卡切換效果(自寫原生js)
- 使用vue.js寫一個(gè)tab選項(xiàng)卡效果
- Vue.js組件tabs實(shí)現(xiàn)選項(xiàng)卡切換效果
- js實(shí)現(xiàn)tab選項(xiàng)卡函數(shù)代碼
- 原生js實(shí)現(xiàn)tab選項(xiàng)卡切換
- Vue.js組件tab實(shí)現(xiàn)選項(xiàng)卡切換
- 4種JavaScript實(shí)現(xiàn)簡單tab選項(xiàng)卡切換的方法
- js簡單實(shí)現(xiàn)豎向tab選項(xiàng)卡的方法
- JS實(shí)現(xiàn)滑動菜單效果代碼(包括Tab,選項(xiàng)卡,橫向等效果)
- JavaScript實(shí)現(xiàn)Tab選項(xiàng)卡切換
相關(guān)文章
js控制href內(nèi)容的連接內(nèi)容的變化示例
這篇文章主要介紹了使用js控制href內(nèi)容的連接內(nèi)容的變化,需要的朋友可以參考下2014-04-04JavaScript中判斷原生函數(shù)檢查function是否是原生代碼
檢查某個(gè)function是否是原生代碼,要檢測這一點(diǎn),最簡單的辦法當(dāng)然是判斷函數(shù)的 toString 方法返回的值2014-09-09JavaScript運(yùn)動框架 鏈?zhǔn)竭\(yùn)動到完美運(yùn)動(五)
這篇文章主要為大家詳細(xì)介紹了JavaScript運(yùn)動框架的第五部分,鏈?zhǔn)竭\(yùn)動到完美運(yùn)動,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下2017-05-05javascript input輸入框模糊提示功能的實(shí)現(xiàn)
這篇文章主要介紹了javascript input輸入框模糊提示功能的實(shí)現(xiàn)的相關(guān)資料,希望通過本能幫助到大家,需要的朋友可以參考下2017-09-09JavaScript實(shí)現(xiàn)語音排隊(duì)叫號系統(tǒng)
語音排隊(duì)叫號系統(tǒng)廣泛用于銀行,餐飲,醫(yī)院等場景。本文主要介紹了通過JavaScript實(shí)現(xiàn)的語音排隊(duì)叫號系統(tǒng),有掃碼排隊(duì),語音叫號等功能。需要的可以參考一下2021-12-12

Javascript前端UI框架Kit使用指南之kitjs的對話框組件
本文以kitjs對話框組件為例,給我們詳細(xì)介紹了kitjs的組件目錄、默認(rèn)代碼模板、構(gòu)造器及初始方法、以及Kitjs繼承。講解的非常細(xì)致,對我們熟練掌握kitjs組件很有幫助。
2014-11-11