Click to return to the DHTML, HTML     
AVOIDMOUSE Attribute | AV...     Behaviors Library    
Web Workshop  |  DHTML, HTML & CSS

tooltip Behavior


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>
Scriptingobject.style.behavior = "url('tooltip.htc')"
object.addBehavior ("tooltip.htc")

Possible Values

Prefix Prefix used to associate CustomTag with a namespace. This prefix is set using the XMLNS attribute of the HTML element.
CustomTag User-defined tag.
sID String that uniquely identifies the object.

Members

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 page is completely loaded, that all behaviors have been applied to corresponding elements on the page, 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>
</tool:tip>

<DIV ID = "oDIV">
This DIV has a tooltip.
</DIV>
</BODY>
</HTML>
This feature requires Internet Explorer 5 or later. Click the icon below to install the latest version. Then reload this page to view the sample.
Microsoft Internet Explorer

See Also

DHTML Behaviors, Using DHTML Behaviors



Back to topBack to top

Did you find this topic useful? Suggestions for other topics? Write us!

© 1999 Microsoft Corporation. All rights reserved. Terms of use.