Changing an Image When a Visitor Points

You can make an image change when the visitor points at it. This is commonly called a “rollover”.

To change an image when the visitor points at it:

Type <a href="page.html", where page.html is the page that will be displayed if the visitor actually clicks the link (as opposed to just pointing at it).
Type onmouseover="document. imgname.src=, where imgname is the value of the img tag’s name attribute (see step 11, below). Note that there are no spaces before or after the periods.
Type 'image-in.jpg', where image-in.jpg is the name and extension of the image file that should be displayed when the visitor points at the image.
Type " to complete the attribute.
Type onmouseout="document. imgname.src= ...

Get HTML, XHTML, & CSS, Sixth Edition: Visual QuickStart Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.