capt webb
Capt. Horatio T.P. Webb
VBSCRIPT Message Box
and
JAVASCRIPT Alert box
Examples

 

VBSCRIPT Buttons Examples:

  1. Icon-type shown in the message box:
    Critical message (red circle with an "X" icon)
    Warning Query (blue circle with question mark)
    Warning Message (yellow triangle with exclamation point)
    Information Message (blue circle with an "i")

  2. Which Button is the default (focused)?
    1st is button-default
    2nd is button-default
    3rd is button-default
    4th is button-default
    The choice here is "focused" when the buttons first appear.
    If you press the "Return" key, the "focused" button action is used.

  3. Title
    These words appear at the top of the message box.

  4. Message
    These words appear in the centered in the message box.

  5. Five button-choices:
    "OK" onlybutton-choice=0
    "OK or Cancel"button-choice=1
    "Abort, Retry or Ignore"button-choice=2
    "Yes, No or Cancel"button-choice=3
    "Yes or No"button-choice=4
    "Retry or Cancel"button-choice=5

  6. User action? (value returned by msgbox function):

    1="OK" clicked
    2="Cancel" clicked
    3="Abort" clicked
    4="Retry" clicked
    5="Ignore" clicked
    6="Yes" clicked
    7="No" clicked


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):

  1. 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

  2. icon-type (see 1 above):
    16 = Critical Message icon
    32 = Warning Query icon
    48 = Warning Message icon
    64 = Information Message icon

  3. 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

  4. 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

    Message
    These words appear in the alert, confirm and prompt box versions.

    Default data (for prompt box only)

    Alert
    Confirm
    Prompt

    User action (confirm or prompt only, see code example (3) below):

    Usage of the three versions of alerts for javascript are:

    1. alert ("message string");

      Here message string is what you want displayed in the alert box. The alert returns no value.

    2. var a = confirm("message string");

      When the confirm is executed, a display with your message string appears. Two buttons also appear: "OK" and "Cancel". If the user clicks the "ok" button, the confirm returns true -- if the "Cancel" button is clicked the confirm returns false. Here is an code example code to process a confirm:

      var a=confirm("Do you want to continue?");
      if (a==true)
         document.f2.ans2.value="OK";
      else
         document.f2.ans2.value="CANCEL";
      

    3. prompt ("message string" , "default data");

      The message string appears at the top left of the prompt box. A textbox where the user can enter data appears at the bottom of the prompt box. If you wish, you may inityially fill this textbox with data by supplying a value for the default data string. Here is a code example for the prompt:

      var ans=prompt(t,pt);
      if (ans!=null && ans!="")document.f2.ans2.value=ans;