show different images when you pass your mouse over it - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:Image

Description

show different images when you pass your mouse over it

Demo Code

ResultView the demo in separate window

<html>
   <head> 
      <title>rollover demo</title> 
      <script type="text/javascript">
    function swap(element, image) {
      element.src = image;/*ww  w  . j a  v  a  2 s  .c  o m*/
    }
  
      </script> 
   </head> 
   <body> 
      <img src="home_normal.png" onmouseover="swap(this, 'home_rollover.png');" onmouseout="swap(this, 'home_normal.png');"> 
      <img src="about_normal.png" onmouseover="swap(this, 'about_rollover.png');" onmouseout="swap(this, 'about_normal.png');">  
   </body>
</html>

Related Tutorials