Show/hide image with JavaScript

后端 未结 6 651
抹茶落季
抹茶落季 2020-12-08 15:17

I have an HTML page with an image that I set to be invisible by CSS visibility: hidden. I want to make a link called \"Show image\", so that when I click on it,

6条回答
  •  爱一瞬间的悲伤
    2020-12-08 15:42

    HTML

    
    Show image
    

    JavaScript:

    document.getElementById("showImage").onclick = function() {
        document.getElementById("theImage").style.display = "block";
    }
    

    CSS:

    #theImage { display:none; }
    

提交回复
热议问题