Are you ready?
Up

Enter your name:

The script is shown below:

<script LANGUAGE="VBSCRIPT">

<!--

Sub cmd1_Onclick()

Response = MsgBox("Hello " & Form1.Text1.value & ", are you ready to rumble?", 36)

If response = 6 Then

    MsgBox "Okay, Let's see what we can do!", 64

Else

    MsgBox "This function has been canceled", 64

End if

End Sub

-->

</script>

In the fourth line, note that the 'text' property of the text box is called 'value' in VBScript, and notice that the VB format of controlname.property becomes formname.controlname.property in VBScript - it's necessary to specify the name of the form since there may be several forms on the same page. At the end of the same line, note that you cannot use VB constants such as VBYesNo in VBScript - you will have to look up the numerical values and include them in the code. The numerical value that corresponds to VBYesNo is 36 and, lower down the page, 6 corresponds to VBYes and 64 corresponds to 'display Information Message icon (the letter 'i' in a speech bubble)'.

Previous Up Next