<div class="box" id="box"></div>
<button onclick="myfunction()">按钮</button>
<script>
function myfunction() {
var box = document.getElementById("box");
if (box.style.backgroundColor="aqua")
{
box.style.backgroundColor="red";
}
else {
box.style.backgroundColor="black";
}
}
</script>
想上天的猪
qq_y见你很幸福_0
klivitamJ
在多重if-else语句中,最后一条执行代码前的语句不应该是else吗?
为什么这里的if else语句不需要{ }也能运行
if语句和else语句的对应问题
多重if-else语句和if-else语句有什么区别?
慕田峪6141110
_bug终结者_
慢l慢