imageRollover Behavior

This topic documents a feature of Binary Behaviors, which are obsolete as of Internet Explorer 10.

Provides rollover effects for images.


HTML <IMG STYLE="behavior:url('')" ID=sID>
Scripting object .style.behavior = "url('')"
object .addBehavior ("")

Possible Values

sID String that specifies a unique identifier for the object.

Members Table

The following table lists the members exposed by the imageRollover object.

Attribute Property Description
HOVERSRC hoverSrc Specifies the image source to display when the mouse cursor hovers over an object.
PRESSEDSRC pressedSrc Specifies the new image source to display when the img object is clicked.


The behavior-defined members listed in the preceding table are not accessible through script until the window. onload event fires. Waiting for this event to fire ensures that the document is completely loaded, that all behaviors have been applied to corresponding elements on the document , and, consequently, that all the behavior's properties, methods, and events are available for scripting. Attempting to use any of the behavior-defined members will result in a scripting error indicating that the object does not support that particular member.

The imageRollover behavior allows developers to specify a replacement image to be displayed when the mouse cursor hovers over an img object, or when the img object is clicked. Use the HOVERSRC and PRESSEDSRC attributes to specify the image sources for the events.

The file can be downloaded from the imageRollover  sample page.


This sample demonstrates the implementation of the imageRollover behavior to create a toolbar.

.rollover { behavior : url( }

   <IMG SRC =" back1.jpg"
   HOVERSRC = "back2.jpg"
   PRESSEDSRC = "back3.jpg"

<!-- Append additional images -->


Code example:

Applies To


Community Additions