点击使用 javascript 的链接时,我想在同一页面上显示图片div ?我怎样才能做到这一点?
答案 0 :(得分:1)
在Javascript中:
<script language="javascript">
function toggle() {
var ele = document.getElementById("toggleImage");
if(ele.style.display == "block") {
ele.style.display = "none";
}
else {
ele.style.display = "block";
}
}
</script>
<a id="displayText" href="javascript:toggle();">show</a>
<img id="toggleImage" style="display: none" src="/abc.jpeg" />