Binds a function in the script component to a notification message sent from the host.
|
---|
behavior.attachNotification (fpNotify) |
Values
- behavior
The ID of the <implements> element used to implement the Behavior interface.
Note |
---|
By default, the properties and methods exposed by the Behavior handler are automatically added to the global script namespace and can be accessed without referencing the Behavior handler ID. In this case, instead of using Behavior.attachNotification as shown in the syntax, the method can be used in script simply as attachNotification. For more details, see the <implements> element. |
- fpNotify
The name of the function to bind to the notification.
Remarks
Example
The example below demonstrates how a function could be set up to trap notifications and process them as appropriate.
| Copy Code |
---|
<?XML version="1.0"?>
<component>
<implements type="Behavior">
<event name="onResultChange"/>
</implements>
<script language="JScript">
<![CDATA[
attachNotification (onNotification);
function onNotification (sNotification){
if (sNotification == "contentReady"){
// Contents of element have changed.
}
else if (sNotification == "documentReady"){
// Host has finished parsing element.
}
window.status = sNotification;
}
]]>
</script>
</component> |
See Also