Fires when the content of the element, to which the behavior is attached, has been completely parsed.
Syntax
<PUBLIC:ATTACH
EVENT = oncontentready
ONEVENT = sEventHandler
FOR = element
ID = sID
/>
Attributes
- EVENT
- Required. String that specifies the name of a Dynamic HTML (DHTML) event, or any of the events specific to the HTML Component (HTC) that are listed in the HTC Reference.
- FOR
- Optional. String that specifies one of the following values to identify the source of the event.
document | Refers to the document object. |
element | Default. Refers to the element to which the behavior is attached. |
window | Refers to the window object. |
- ID
- Optional. String that uniquely identifies the PUBLIC:ATTACH element within the component. This attribute is analogous to the ID attribute in Dynamic HTML (DHTML).
- ONEVENT
- Required. String that specifies an inline script or a direct invocation of the event handler function.
Remarks
The innerHTML property of the element might not return the correct value until this event fires.
When this event is fired and the literalContent attribute of the PUBLIC:COMPONENT element is true, the literal content of the Element Behavior has been stored in the innerHTML property. This event indicates to the element behavior that it can then access the innerHTML property.
Because this event is specific to HTC components, the only way to bind to the oncontentready event is by using the PUBLIC:ATTACH element. The attachEvent method does not bind to this event because it works with standard DHTML Events only. When an HTC file is implemented as a Viewlink, the oncontentready event, or any other event that is HTC-specific, cannot be attached to an element in the document fragment.
See Component Initialization for an overview of events fired during the initialization of an HTC file and its primary document.
Example
This example uses the oncontentready event on a page to display the value of the element's innerHTML property.
<PUBLIC:ATTACH EVENT="oncontentready" ONEVENT="show_innerHTML()" />
<SCRIPT LANGUAGE="JScript">
function show_innerHTML()
{
window.alert ('innerHTML = ' + element.innerHTML);
}
</SCRIPT>
See Also
Introduction to DHTML Behaviors, About Element Behaviors, Using HTML Components to Implement DHTML Behaviors in Script