Programmer's Guide > Programming and Scripting Techniques > Events > Event Handlers > VBScript
  
VBScript
In VBScript, the event handler is declared as a class:
Class EventListener
Public Function handleEvent(ByVal evt)
Dim node
set node = evt.target
Dim context
context = ""
While Not node Is Nothing
If node.nodeType = 1 Then
context = "(" & node.nodeName & context
End If
Set node = node.parentNode
Wend
Application.print(context)
Application.print()
evt.stopPropagation()
handleEvent = 0
End Function
End Class
Dim doc
set doc = Application.activeDocument
Dim listener
set listener = new EventListener
doc.addEventListener "click", listener, true