Javascript examples for CSS Style Property:visibility
Hide and show an <img> element:
<!DOCTYPE html> <html> <body> <img id="myImg" src="http://java2s.com/resources/c.png" width="100" height="132"> <br> <button type="button" onclick="hideElem()">Hide image</button> <button type="button" onclick="showElem()">Show image</button> <script> function hideElem() {// w w w .java2s . c o m document.getElementById("myImg").style.visibility = "hidden"; } function showElem() { document.getElementById("myImg").style.visibility = "visible"; } </script> </body> </html>