See also: alert, confirm

Displays a Prompt dialog box with a message and an input field.

Syntax

JSV_prompt(title, msg, defaultMsg)

Prototype

n/a

Returns

The prompt method returns the user's input or the default value of the input field.

Parameters

The prompt function uses the following arguments.

Argument Description
title A string to be displayed in the dialog title bar
msg A string to be displayed as the message to the user
defaultMsg A string or integer representing the default value of the input field

Remarks

If the user clicks the Cancel button, the return value is "undefined".

Dependencies

n/a

Example

The following lines of code

function testPrompt() {
    var amountOrdered = JSV_prompt("JavaScript Vision Prompt", "Enter the number of widgets you would like to order:", 1);
    JSV_alert("Widgets, Inc.", "You ordered " + amountOrdered + " widgets.");
}

produce

Test Prompt Dialog