📄 barnavswitch2.js
字号:
var barNav = document.getElementById("div_barNav");
var barH2 = barNav.getElementsByTagName("h2");
var barDiv= barNav.getElementsByTagName("div");
var barA= barNav.getElementsByTagName("a");
var navBotton = document.getElementById("h2_navBotton");
var bottonSpan = navBotton.getElementsByTagName("span");
bottonSpan[1].style.display ="none";
for(i=0; i<barH2.length; i++){
barH2[i].ids = i;
barH2[i].onclick = function(){
for(j=0; j<barH2.length; j++){
barH2[j].className = "";
}
barH2[this.ids].className = "on";
if(barDiv[this.ids].className==""){
barDiv[this.ids].className="now";}else{
barDiv[this.ids].className="";}
}
}
for(j=0; j<barA.length; j++){
barA[j].ids = j;
barA[j].onclick = function(){
for(k=0; k<barA.length; k++){
barA[k].className = "";
}
barA[this.ids].className = "on";
}
}
navBotton.onclick = function(){
if(bottonSpan[1].style.display =="none"){
bottonSpan[0].style.display ="none"
bottonSpan[1].style.display ="";
for(j=0; j<barH2.length; j++){
barDiv[j].className="now";
}
}else{
bottonSpan[1].style.display ="none"
bottonSpan[0].style.display ="";
for(j=0; j<barH2.length; j++){
barDiv[j].className="";
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -