Basic Mousing

 

The simplest way to use the onMouseOver handler is to embed it in an <A> tag. It won't work anywhere else, but if all you want to do is make the pictures change and not provide a link to somewhere else use a non-existent anchor. EG <A HREF="#null">.

The breakdown of the code below goes like this. The onMouseOver tag is placed in the <A> tag after the HREF attribute. onMouseOver actually behaves as a normal HTML attribute, thus ensuring that browsers that don't understand it will just ignore it (although this doesn't mean that JavaScript-capable browsers that don't understand what comes after will ignore that). Because it is regarded as HTML you need to put the following JavaScript inside quotation marks, and anything that you need to put in quotation marks within that therefore has to be in single quotes, like that mousesm.jpg URL.

When the cursor moves over the image the onMouseOver handler calls the JavaScript routine inside the quotes. Here the JavaScript tells Navigator to replace image number 0 - computers start counting at zero - in the document with the URL specified.

Note that this numerical listing of images is independent for each frame. Therefore the image in the frame on the right is image 0, no matter what other images - such as the mice below - are in other frames.

 

 

 

backnext

Back | Next

 

© Wide Area Communications, 1996, 1997