department = DepartmentSerializer(source='course.department')
function showX()
document.getElementById("one").style.display = "block";
document.getElementById("two").style.display = "none";
document.getElementById("three").style.display = "none";
function showZ()
document.getElementById("one").style.display = "none";
document.getElementById("two").style.display = "block";
document.getElementById("three").style.display = "none";
function showY()
document.getElementById("one").style.display = "none";
document.getElementById("two").style.display = "none";
document.getElementById("three").style.display = "block";
div {display:inline;}
div img {width:400px;height: 400px;}
#one {
display: none;
}
#two {
display: none;
}
#three {
display: none;
}
当我单击我的图像时,什么都没有发生? 有人可以帮我吗?
我一直在努力解决这个问题,所以决定来这里。 预先感谢您的帮助!
我对编程很陌生,我正在创建的网站项目需要它。
我需要它,所以当我访问网站时,它将仅显示图片,而不显示部分。单击图片后,它将显示第一部分,但其他部分保持隐藏。
答案 0 :(得分:2)
您缺少大括号{}
。可以了您还应该调用该函数。
function showX(){
document.getElementById("one").style.display = "block";
document.getElementById("two").style.display = "none";
document.getElementById("three").style.display = "none";
}
function showZ(){
document.getElementById("one").style.display = "none";
document.getElementById("two").style.display = "block";
document.getElementById("three").style.display = "none";
}
function showY(){
document.getElementById("one").style.display = "none";
document.getElementById("two").style.display = "none";
document.getElementById("three").style.display = "block";
}
showZ();
div {display:inline;}
div img {width:400px;height: 400px;}
#one {
display: none;
}
#two {
display: none;
}
#three {
display: none;
}
<html>
<section id="one">
take this info es cool 1
</section>
<section id="two">
take this info es cool 2
</section>
<section id="three">
take this info es cool 3
</section>
</html>