Maison  >  Article  >  interface Web  >  js tab 选项卡_javascript技巧

js tab 选项卡_javascript技巧

WBOY
WBOYoriginal
2016-05-16 18:53:511524parcourir

一般需要事先写好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; iif ( i != sId) {
boxs[i].style.display = "none";
tabs[i].style.backgroundColor="#E3F4FE";
tabs[i].style.color="#000000";
}
}
}


中英合作自考







Déclaration:
Le contenu de cet article est volontairement contribué par les internautes et les droits d'auteur appartiennent à l'auteur original. Ce site n'assume aucune responsabilité légale correspondante. Si vous trouvez un contenu suspecté de plagiat ou de contrefaçon, veuillez contacter admin@php.cn