Compartilhar via


GetRef Function

 

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

Syntax

Set object.eventname = GetRef(procname)

Arguments

  • object
    Required. Name of the object with which event is associated.

  • event
    Required. Name of the event to which the function is to be bound.

  • procname
    Required. String containing the name of the Sub or Function procedure being associated with the event.

Remarks

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.

<SCRIPT LANGUAGE="VBScript">

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")
</SCRIPT>

Requirements

Version 5

See Also

Function Statement (VBScript)
Set Statement
Sub Statement