我的 CSS:
#a_x200{
visibility: hidden;
width: 200px;
height: 200px;
background-color: black;
}
我的JS:
<script type="text/javascript">
function show(id) {
document.getElementById(id).style.display = 'block';
}
</script>
我的 HTML
<div id="a_x200">asd</div>
<innput type="button" class="button_p_1" onclick="show('a_x200');"></input>
不工作我想我错过了什么!
最佳答案
试试这个:
document.getElementById('a_x200').style.visibility = 'visible';
关于javascript - 使用普通 JS 显示/隐藏 div,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13836848/