MathCurvesSurfacesWallpaper GroupsGallerySoftwarePOV-Ray
ProgramingLinuxPerl PythonHTMLCSSJavaScriptPHPJavaEmacsUnicode ♥
Web Hosting by 1&1

JavaScript: Image Rollover Example

Xah Lee, ,

This page shows a simple example of image rollover. Move your mouse to the following image and see it change.

tile A

Here's the HTML code:

<img id="id07896" src="i/tile_A.png" alt="tile A">

Following is the JavaScript code:

var myobj = document.getElementById("id07896");
myobj.onmouseover = function() { myobj.src="i/tile_B.png";};
myobj.onmouseout = function() { myobj.src="i/tile_A.png";};
blog comments powered by Disqus