advise Method

See Also            Applies To

Registers an object to be notified when a specific event occurs and to call a particular function.

Syntax

[id = ]object.advise(strEvent, CallFunction)

Parameters

id

An identifier that can be used by the unadvise method to unregister the object.

object

A script object.

strEvent

The event that causes the object to be notified.

CallFunction

The function to call when the event occurs.

Remarks

Script objects have implicit events for which advise is not needed. Each script object's topic lists these events.

For the PageObject object, use the advise method to register an event if you use a Visual Basic®, Scripting Edition (VBScript) function to handle the onbeforeserverevent event on the client.

JavaScript and VBScript use a slightly different syntax when passing a reference to a function.

Use the unadvise method to cancel the registration of the object.

Example

This following script will call the function, "Button1_onmouseover", when the onmouseover event occurs. The example is using a button target to DHTML as the scripting platform.

<SCRIPT FOR="window" EVENT="onload" LANGUAGE="JavaScript">
Button1.advise("onmouseover", Button1_onmouseover);
</SCRIPT>