gpt4 book ai didi

javascript - 自定义 javascript 开/关开关无法正常工作

转载 作者:行者123 更新时间:2023-11-30 16:09:51 25 4
gpt4 key购买 nike

<分区>

所以我想做一个开关,点击时会在“滑雪”和“滑雪板”之间切换

我觉得我的 java 应该可以工作,但由于某种原因没有任何反应。

function switch(a,b){
document.getElementById(a).style.display = "none";
document.getElementById(b).style.display = "";}
.switch {
border: 1px solid black;
background-color: rgb(220,220,220);
padding: 2px;
width:150px;
height:24px;

}

#on {
float:left;
display:"";
width: auto;
height:20px;
background-color: rgb(95,170,250);
}

#off {
float:right;
display:none;
width: auto;
height:20px;
background-color: rgb(250,50,25);
}
      <div class="switch">
<div id="on" onclick="switch(on,off)">
Ski
</div>
<div id="off" onclick="switch(off,on)">
Snowboard
</div>
</div>

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com