element Object

MS Office DHTML, HTML & CSS

element Object


Returns the element to which the behaviorInternet Link is attached.

Remarks

All properties, methods, and events of the element are accessible to an HTML Component (HTC) using this object, or by using the property, method, or event name directly and not prefixing the name with the element keyword.

Example

This example uses a behavior to implement a table of contents that expands and collapses when the user clicks it. The HTC attaches to the element's onmouseover event and sets the color property of the element to red. The color of the element can be toggled through the style property of the element directly, instead of referring to it as element.style.

The HTC also sets the cursor property to "hand" to signal the user that the element can be clicked to toggle visibility of its children.

<PUBLIC:ATTACH EVENT="onmouseover" ONEVENT="Hilite" />

<SCRIPT LANGUAGE="JScript">
var prevColor;

function Hilite()
{
   prevColor = style.color;  
   element.style.color  = "red";
   element.style.cursor = "hand";
}
</SCRIPT>
This feature requires Microsoft® 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 behaviorsInternet Link, implementing dhtml behaviors in scriptInternet Link


Back to topBack to top

Did you find this topic useful? Suggestions for other topics? write us!Internet Link

© 1999 microsoft corporation. all rights reserved. terms of useInternet Link.