Swap logo when clicking a link and reaching a certain page section - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:Image

Description

Swap logo when clicking a link and reaching a certain page section

Demo Code

ResultView the demo in separate window

<html>
   <head> 
      <meta name="viewport" content="width=device-width, initial-scale=1"> 
   </head> 
   <body> 
      <img id="logo" src="http://icons.iconarchive.com/icons/yellowicon/game-stars/256/Mario-icon.png" alt="logo1"> 
      <br> 
      <button onclick="changeLogo()">About</button> 
      <script>
function changeLogo(){//from   w ww .  jav a 2 s.  co  m
    document.getElementById("logo").src = "http://www.java2s.com/style/download.png";
}

      </script>  
   </body>
</html>

Related Tutorials