jPaq Docs - alert()

Quick Stats

Target Platforms:  PC (JScript)
Download Count:  376

Summary

Gives the user the ability to show a dialog box with a message, title, and specific icon. This function is very similar to VBScript's MsgBox function.

Parameters

  1. message => String
    The message that appears in the dialog box.
  2. [title] => String
    Optional. The title of the dialog box. By default, this value is the file name of the script.
  3. [options] => Number

    Optional. The integer that indicates which options are to be used. The default is the equivalent of using "alert.OKOnly + alert.Exclamation". The following constants will cause certain button sets to appear within the dialog:

    • alert.OKOnly - Show the message box with an "OK" button.
    • alert.OKCancel - Show the message box with an "OK" and "Cancel" buttons.
    • alert.AbortRetryIgnore - Show the message box with an "Abort", "Retry" and "Ignore" buttons.
    • alert.YesNoCancel - Show the message box with an "Yes", "No" and "Cancel" buttons.
    • alert.YesNo - Show the message box with an "Yes" and "No" buttons.
    • alert.RetryCancel - Show the message box with an "Retry" and "Cancel" buttons.

    The following lists the constants for the icons that may appear in the dialog box.

    • alert.Critical - Show the "Stop" icon.
    • alert.Question - Show the "Question Mark" icon.
    • alert.Exclamation - Show the "Exclamation Mark" icon.
    • alert.Information - Show the "Information" icon.

    The following lists the constants for the possible dialog responses.

    • alert.Timeout - Returned if the message box timed out.
    • alert.OK - Returned when the "OK" button is pressed.
    • alert.Cancel - Returned when the "Cancel" button is pressed.
    • alert.Abort - Returned when the "Abort" button is pressed.
    • alert.Retry - Returned when the "Retry" button is pressed.
    • alert.Ignore - Returned when the "Ignore" button is pressed.
    • alert.Yes - Returned when the "Yes" button is pressed.
    • alert.No - Returned when the "No" button is pressed.

  4. [timeout] => Number
    Optional. The number of seconds before the dialog box closes itself.

Returns

Number
If a timeout occurs, alert.Timeout is returned. If a timeout doesn't occur, the response constant associated with the button pressed will be returned.

Related Examples

  1. Alerting The PC User
    If you have ever written a JScript to carry out a specific task, you may have noticed that using WScript.Echo() can be a little…