.

Pialog boxes in javascript Assignment Help

Dialog boxes

  • Alert Dialog box
  • Confirmation dialog boxes
  • Prompt dialog boxes

13.1 Alert Dialog box

It alerts user when something goes wrong in web pages. It is used for validation purpose whether the user supplies valid input to all required fields.

Syntax

alert(“message”);

alert is a keyword to display alert dialog box.

Example:

dialog boxes img1

13.2 Confirmation Dialog Box

This dialog boxes are used to get approval from the user. It has two buttons such as OK and cancel. Ok indicates the Boolean value true or ‘1’ , cancel indicates the Boolean value false or ‘0’.

Syntax:

confirm(“message”);

Example program:

dialog boxes img2

13.3 Prompt Dialog box

Prompt dialog boxes are used retrieve response from the end user. The prompt dialog bix consists the given text, text box to feed input, two buttons ok and cancel.

Syntax:

prompt(“Message to be appear on the prompt dialog box”);

Example code

dialog boxes img3

Output

dialog boxes img4 dialog boxes img5
.