[go: up one dir, main page]

0% found this document useful (0 votes)
21 views1 page

Alert, Prompt, Confirm

Alert, prompt, and confirm are modal JavaScript functions that pause script execution and display message windows. Alert shows a message and waits for the user to click OK. Prompt shows text and an input field with optional initial value and OK/Cancel buttons. Confirm displays a question and returns true for OK or false for Cancel. All depend on the browser for exact window placement and styling.

Uploaded by

joshuaharris1107
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
21 views1 page

Alert, Prompt, Confirm

Alert, prompt, and confirm are modal JavaScript functions that pause script execution and display message windows. Alert shows a message and waits for the user to click OK. Prompt shows text and an input field with optional initial value and OK/Cancel buttons. Confirm displays a question and returns true for OK or false for Cancel. All depend on the browser for exact window placement and styling.

Uploaded by

joshuaharris1107
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

INTERACTIONS: ALERT, PROMPT, CONFIRM:

alert:
It shows the message and waits for the user to press "OK".

prompt:
The function "prompt" accepts two arguments:
It shows a modal window with a text message, an input field for the visitor, and
the buttons OK/Cancel.
The second parameter is optional: the initial value for the input field.

confirm:
The syntax:
result = confirm(question);

The function confirm shows a modal window with a question and two buttons: OK and
Cancel.
The result is true if OK is pressed and false if Cancel is pressed.

All these methods are modal: they pause script execution and don't allow the
visitor to interact with the rest of the page until the window has been dismissed.
There are two limitations shared by all of the methods above:
1. The exact location of the modal winodw is determined by the browser.
Usually, it's in the center.
2. The exact look of the window also depends on the browser. We can't modify
it.

You might also like