Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

ToolTip Behavior

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

Adds a rich HTML ToolTip control to the document.

Syntax

XML <Prefix: CustomTag ID=sID STYLE="behavior:url('tooltip.htc')" />
HTML <ELEMENT STYLE="behavior:url('tooltip.htc')" ID=sID>
Scripting object .style.behavior = "url('tooltip.htc')"
object .addBehavior ("tooltip.htc")

Possible Values

Prefix Prefix that associates the CustomTag with an XML namespace. This prefix is set using the XMLNS attribute of the HTML tag.
CustomTag User-defined tag.
sID String that specifies a unique identifier for the object.

Members Table

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

Attributes/Properties
Attribute Property Description
AVOIDMOUSE avoidMouse Sets or retrieves whether the ToolTip behavior moves away from the mouse cursor.
DELAY delay Sets or retrieves the amount of time, in milliseconds, before showing the ToolTip.
DURATION duration Sets or retrieves how long the ToolTip is displayed, in seconds.
ELEMENT element Sets or retrieves the ID attribute of the object that uses the ToolTip behavior.
Events
Event Property Description
onerror Fires when a property is assigned an invalid value, or the property is read-only, for the ToolTip behavior.
onhide Fires when the ToolTip behavior is no longer visible.
onshow Fires when the ToolTip is displayed for the ToolTip behavior.

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.

When the mouse cursor hovers over the element participating in the ToolTip behavior, the ToolTip will appear after the amount of time specified in the DELAY attribute. The ToolTip appears at the bottom-right corner of the mouse and disappears after the amount of time specified by the DURATION attribute, or when the mouse cursor moves outside the element, unless the mouse cursor moves over the ToolTip and the AVOIDMOUSE attribute is set to 1. To prevent a ToolTip from appearing on certain elements, existing TITLE and ALT attribute values are cleared for the object participating in the behavior. The behavior allows authors to attach the ToolTip to a collection of elements, when there is more than one element with the same ID.

The tooltip.htc file can be downloaded from the ToolTip  sample page.

In addition to the members and styles previously listed, the ToolTip behavior supports:

Example

This sample demonstrates the implementation and adjustments of the ToolTip behavior.


<HTML XMLNS:Tooltip>
<HEAD>
<style>
@media all{
   tooltip\:tip{behavior: url("/behaviors/tooltip.htc");}
}
</style>
</HEAD>
<BODY>
<tooltip:tip element = "oDIV">    
<b>ToolTip text.<b>
</tooltip:tip>

<DIV ID = "oDIV">
This DIV has a ToolTip.
</DIV>
</BODY>
</HTML>

Code example: http://samples.msdn.microsoft.com/workshop/samples/author/behaviors/library/tooltip/tooltip_js.htm

See Also

Community Additions

Show:
© 2014 Microsoft. All rights reserved.