Img onmouseover and onmouseout actions
<html> <head> <title>Rollover</title> <script type="text/javascript"> function rollover() { var images = document.getElementsByTagName("img"); for (var i = 0; i < images.length; i++) { images[i].onmouseover = function() { this.src = this.id + "_over.png"; } images[i].onmouseout = function() { this.src = this.id + "_default.png"; } } } window.onload = rollover; </script> </head> <body> <p><img id="home" name="img_home" src="a.png" alt="Home"></p> </body> </html>