I’ve found a tutorial on Atlanta Jones. Read it, it’s worth it. Here is an example that works with the Default theme of WordPress and the Category Icons plugin with its Widget.
1. Create an empty file named rollover.js at the root of your theme folder.