Microsoft Visual Basic Scripting Edition

Hello, world

How does this sample work? The HTML for the page has two salient features.

First, there is an INPUT tag that causes a button named "BtnHello" to be created.

	
	<INPUT TYPE=BUTTON VALUE="Click me" NAME="BtnHello">
Second, there is a script tag that contains an event handler for BtnHello's "OnClick" event. As in Visual Basic, event handlers are named using the pattern ObjectName_EventName, which in this case means BtnHello_OnClick. When the button is clicked, the procedure with that name is run. In response to the button being clicked the event handler puts up a message box by using VBScript's MsgBox runtime function.

	<SCRIPT LANGUAGE="VBScript">
		Sub BtnHello_OnClick
			MsgBox "Hello, world!", 0, "My first active document"
		End Sub
	</SCRIPT>