当我单击一个框时,我制作了这段代码来显示一个 div:
JS
<script type="text/javascript">
var bool = 0;
function showDiv() {
if (bool == 1) {
bool = 0;
document.getElementById('show').style.visibility = "hidden";
} else if (bool == 0) {
bool = 1;
document.getElementById('show').style.visibility = "visible";
}
}
</script>
HTML
<input type="button" value="click" onclick="showDiv();" />
<div id="show" style=" visibility:hidden;">
<p>it is okay it is okay it is okay it is okay it is okay</p>
</div>
但是,当我想要单击以显示 div 的图像时,我该怎么做。