| home / experts / dhtml / column22 |
| ||||||||||||||||
VBScript has its own dialogs, similar to those of JavaScript, but with the option of customization.
The Message Box dialog is created using the VBScript MsgBox() function:
MsgBox(prompt,buttons,title)
![]() MsgBox( "My Message Box Title", 4, "My Message Box Message") (4 + 0 + 0 + 0) ![]() MsgBox( "DHTML Lab", 292, "Proceed?") (4 + 32 + 256 + 0) ![]() MsgBox("YIKES!", 21, "FATAL!\nSystem\nCrash\nComing!") (5 + 16 + 0 + 0) |
Values for the buttons Argument
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
As you can see, there are four groups of values. To achieve the dialog "look" for our application, we must take one value from each group and add them together. The resulting sum becomes our buttons argument.
Refer to the examples in the left column. Compare the buttons argument value and the resulting dialog to the table above.
| Button Pressed | Return Value |
| OK | 1 |
| Cancel | 2 |
| Abort | 3 |
| Retry | 4 |
| Ignore | 5 |
| Yes | 6 |
| No | 7 |
The MsgBox() function returns an integer value that identifies which button was clicked by the user. The table on the left lists the return values associated with the seven available buttons. The table above lists the possible return values for each button group. We'll be discussing the use of return values later.
It is apparent that the MsgBox() function can be used for better looking Alert and Confirm dialogs. But what about Prompt dialogs?
Produced by Peter Belesis and
| ||||||||||||||||||||
All Rights Reserved. Legal Notices.
Created: Nov. 18, 1998
Revised: Nov. 18, 1998
URL: http://www.webreference.com/dhtml/column22/js-vbMsgBox.html