Visual Basic Scripting Edition  

GetRef Function

Returns a reference to a procedure that can be bound to an event.

Set object.eventname = GetRef(procname)


Required. Name of the object with which event is associated.
Required. Name of the event to which the function is to be bound.
Required. String containing the name of the Sub or Function procedure being associated with the event.


The GetRef function allows you to connect a VBScript procedure (Function or Sub) to any available event on your DHTML (Dynamic HTML) pages. The DHTML object model provides information about what events are available for its various objects.

In other scripting and programming languages, the functionality provided by GetRef is referred to as a function pointer, that is, it points to the address of a procedure to be executed when the specified event occurs.

The following example illustrates the use of the GetRef function.


Function GetRefTest()
   Dim Splash
   Splash = "GetRefTest Version 1.0"   & vbCrLf
   Splash = Splash & Chr(169) & " YourCompany 1999 "
   MsgBox Splash
End Function

Set Window.Onload = GetRef("GetRefTest")


Version 5

See Also

Function Statement | Set Statement | Sub Statement