Image disappears after click on javascript - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:Image

Description

Image disappears after click on javascript

Demo Code

ResultView the demo in separate window

<html>
   <head> 
      <meta name="viewport" content="width=device-width, initial-scale=1"> 
      <script type="text/javascript">
window.onload=function(){//  ww  w.  ja  v a 2  s .c  om
   document.getElementById("my").onclick = function mychoice() {
   var name = 'abc';
   document.getElementById("message").innerHTML = name;
   return('message');
};
    }

      </script> 
   </head> 
   <body> 
      <img id="my" src="http://www.java2s.com/style/download.png"> 
      <p id="message"></p>  
   </body>
</html>

Related Tutorials