WebworkJavaScript MouseOver Image Changes

This is one you see a lot. It is frequently used to create navigation buttons that recede or light up when the mouse moves over them.

First you need to create two images, one for the "on" state and the other for "off."



light-off.jpeg

light-on.jpeg

<a href="javascript:;"
onmouseover="light.src='light-on.jpeg'"
onmouseout="light.src='light-off.jpeg'">
<img name="light" width=75 height=75 border=0 src="light-off.jpeg"></a>

The href="javascript:;" part is a null link - meaning that it doesn't go anywhere or load any new content. It could be replaced with a functional link that would load a new page.

Both images should be the same size.


(BTW, this also works with animated GIFs.)


<Previous | Javascript | Webwork Table of Contents | Next>
 
 © Jay Boersma
free stuff
GIFs 4 Us
The Web Rules
Webpix
Backgrounds 4 Us
Webpaper
Digital Sketches 1
Digital Sketches 2
Fonts
Sounds
archive
The Portals Project
Transition
Insights
Spelling
Webwork
photographs
Barcelona, Catalonia/Spain
Along the Mississippi
Rome and Florence
The Reliance Building
Providence, Rhode Island
Santa Fe, New Mexico
Charleston, South Carolina
hell
The Web
Page from
ape silverback
Primate
Ruminations
rotmp
Revenge
of the
Movie
Poster
element-j
Honda
Element
Site