Estoy tratando de usar la función ocultar/mostrar para mostrar una imagen cuando se hace clic en "<div". Cuando cargo en la página por primera vez, la imagen ya se ha cargado en la pantalla. Me gustaría que la imagen se oculte al cargar la página, lo que permite que la imagen se revele cuando se hace clic en .
function active01() { var x = document.getElementById("img01"); if (x.style.display === "none") { x.style.display = "block"; } else { x.style.display = "none"; } } #img01 { width: 800px; padding-left: 30px; display: none; } <div onclick="active01()" id="line01"> Exhibition_Design_The_Telephone_book_001....................2009-001</div><br> <img id="img01" src="images/01 Exhibition design.jpg" alt="Exhibition_Design_The_Telephone_book_001....................2009-001"><br> function myFunction() { var x = document.getElementById("myDIV"); if (x.style.display === "block") { x.style.display = "none"; } else { x.style.display = "block"; } } #myDIV { width: 100%; padding: 50px 0; text-align: center; background-color: lightblue; display: none; margin-top: 20px; } <button onclick="myFunction()">Try it</button> <div id="myDIV"> This is my DIV element. </div>Mira este ejemplo