Thursday, June 21, 2012

Java Script Tutorial 10 : JavaScript Popup Boxes

There are three kind of popup boxes in JavaScript
  • Alert box
  • Confirm box
  • Prompt box
Alert Box :
An alert box is often used if you want to make sure information comes through to the user. When an alert box pops up, the user will have to click "OK" to proceed. Syntax of Alert Box is as follows :

javascript alert box
Javascript alert box.
For example
javascript alert box in html
Javascript alert box in html.
Confirm Box :
A confirm box is often used if you want the user to verify or accept something. When a confirm box pops up, the user will have to click either "OK" or "Cancel" to proceed. If the user clicks "OK", the box returns true. If the user clicks "Cancel", the box returns false. Syntax of Confirm Box is as follows :

javascript confirm box
Javascript confirm box.
For example

javascript confirm box in html
Javascript confirm box in html.
Prompt Box :
A prompt box is often used if you want the user to input a value before entering a page. When a prompt box pops up, the user will have to click either "OK" or "Cancel" to proceed after entering an input value. If the user clicks "OK" the box returns the input value. If the user clicks "Cancel" the box returns null. Syntax of Prompt Box is as follows :

javascript prompt box
Javascript prompt box.
For example

javascript prompt box in html
Javascript prompt box in html.
To display line breaks inside a popup box, use a back-slash followed by the character n. For example

javascript alert box with line break
Javascript alert box.

No comments:

Post a Comment