Usage is:
<variable> = msgbox(<message-string>,integer,<title-string>)
<variable> is the value returned by the message box (see 6 above)
<message-string> is a user supplied string, see (4) above.
<title-string> is a user supplied string, see (3) above.
integer is the sum of the choices made below for: (a), (b), (c) and (d):
- button-choice (see 5 above):
0 = OK button only
1 = OK and Cancel buttons
2 = Abort, Retry, and Ignore buttons
3 = Yes, No, and Cancel buttons
4 = Yes and No buttons
5 = Retry and Cancel buttons
- icon-type (see 1 above):
16 = Critical Message icon
32 = Warning Query icon
48 = Warning Message icon
64 = Information Message icon
- button-default (see 2 above):
0 = First button is default
256 = Second button is default
512 = Third button is default
768 = Fourth button is default
- mode-of-operation:
0 = the program will not continue until the user responds to the button
4096 = no program on the desktop will execute until the user responds to the button
These button options are encoded as a single integer by adding the coded values defined above to produce a single integer:
bit values for the lowest 13 bits |
bit number--> stores # of--> |
13 212 |
12 211 |
11 210 |
10 29 |
9 28 |
8 27 |
7 26 |
6 25 |
5 24 |
4 23 |
3 22 |
2 21 |
1 20 |
means # of --> |
4096 |
2048 |
1024 |
512 |
256 |
128 |
64 |
32 |
16 |
8 |
4 |
2 |
1 |
used for--> |
mode of operation |
not used |
default button |
not used |
icon-type |
not used |
icon-type |
Resulting values stored in each bit |
0 |
0 |
0 |
0 |
0 |
0 |
0 |
0 |
1 |
0 |
0 |
0 |
0 |
1 |
0 |
1 |
0 |
1 |
0 |
0 |
0 |
1 |
|
1 |
0 |
0 |
1 |
1 |
0 |
1 |
0 |
1 |
1 |
1 |
0 |
0 |
0 |
1 |
1 |
|
|
1 |
0 |
0 |
1 |
0 |
1 |
Program execution is paused until the user clicks a button or presses the return key.
The function returns a single digit integer thats defines which button was pressed (or in the case of the user pressing the return key, which button was the default, as follows:
1 = "OK" clicked
2 = "Cancel" clicked
3 = "Abort" clicked
4 = "Retry" clicked
5 = "Ignore" clicked
6 = "Yes" clicked
7 = "No" clicked
|
JAVASCRIPT Alert, Confirm and Prompt Examples
|