Download

Download: sm-mouse.js
Version:
Released:

Download

Download: sm-common.js
Version:
Released:

MouseOver Madness

I don't know about you but I'm tired of writing JavaScript onmouseover image swaps. Even if you use a canned script like the one produced by Fireworks it's pretty ugly.

Simple Image Swap

Here's a much easier way to produce the same effect. It works by simply placing an sm:mouseover="" attribute in the image that you want to have a rollover effect. The sm:iepng attribute is included in the example so IE will display the PNG correctly.

Example

<script type="text/javascript" src="/javascript/sm-common.js" charset="ISO-8859-1"></script>
<script type="text/javascript" src="/javascript/sm-mouse.js" charset="ISO-8859-1"></script>
...
<img src="smiley.png" sm:mouseover="wink.png" sm:iepng="true"/>

Result