Javascript examples for DOM HTML Element:Image
Create button displays image and set CSS display
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> </head> <body> <img src="" style="display:none" id="img" width="200"> <button class="popup" onclick="display('http://www.java2s.com/style/download.png')">Show Image</button> <script> function display(imagepath){ var img = document.getElementById("img"); img.src = imagepath; img.style.display = 'block'; }// ww w .j av a2 s. co m </script> </body> </html>