VBScript GetRefFunction


VBScript 参考手册Complete VBScript Reference

The GetRef function allows you to connect a VBScript subroutine to a DHTML event on a page.

Syntax

Set object.event=GetRef(procname)

Parameters Description
object Required. The name of the HTML object that the event is associated with.
event Required. The name of the event to bind with the function.
procname Required. The name of the Sub or Function procedure associated with the HTML event.

Example

Example

<button id="myBtn">Click me</button>

<script type="text/vbscript">

document.getElementById("myBtn").onclick=GetRef("mySub")

Sub mySub()
alert("Hello world")
End Sub

</script>

Try it Yourself »

VBScript 参考手册Complete VBScript Reference Other Extensions