imageRollover Behavior

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

Provides rollover effects for images.

Syntax

XML N/A
HTML <IMG STYLE="behavior:url('imageRollover.htc')" ID=sID>
Scripting object .style.behavior = "url('imageRollover.htc')"
object .addBehavior ("imageRollover.htc")

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.

Attributes/Properties
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.

Remarks

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 imageRollover.htc file can be downloaded from the imageRollover  sample page.

Example

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


<STYLE>
.rollover { behavior : url(imagerollover.htc) }
</STYLE>

<TABLE>
<TR>
<TD>
   <IMG SRC =" back1.jpg"
   HOVERSRC = "back2.jpg"
   PRESSEDSRC = "back3.jpg"
   CLASS="Rollover"
>
</TD></TR>

<!-- Append additional images -->

</TABLE>

Code example: http://samples.msdn.microsoft.com/workshop/samples/author/behaviors/library/imagerollover/toolbar_js.htm

Applies To

IMG

Community Additions

Show: