Visual InterDev
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.
If you are scripting in JavaScript, use a function pointer, without parentheses or quotes, as in the following line:
Button1.advise("onmouseover", Button1_onmouseover)
If you are scripting in VBScript, pass the name of a function as an object. This is done by placing quotes around the function name including parentheses, as in the following line:
Button1.advise("onmouseover", "Button1_onmouseover()")
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>