VBScript popup boxes
VBScript provides a few popup boxes to interact with the user. More specifically, alert and prompt boxes.
This tutorial focuses on:
- Displaying an alert box
- Displaying a prompt box
Displaying an alert box
An alert box is a box that appears with a message inside it and a title. The user will have to press the "OK" button or any other potential buttons that appear on the alert box to close it.
An alert box can be displayed using VBScript's MsgBox function together with the text to be displayed in the alert box, a title, and an integer indicating what kind of button or buttons should appear on the message box (0 for just an "OK" button, 1 for an "OK" and "Cancel" buttons).
Displaying a prompt box
A prompt box is used to get data from the user. A prompt box will appear with an "OK" button and a "Cancel" button. Different actions will occur depending on what button the user clicks. If the user clicks the "OK" button, the value entered into the prompt box will be set. If the user clicks the "Cancel" button, an empty string will be set.
A prompt box can be displayed using VBScript's InputBox function.