JavaScript Popup Boxes

What is JavaScript Popup Boxes?
JavaScript Popup boxes is three types...
Alert Box (alert message display to a browser),
Confirm Box (verify or accept some confirm message from user and display on bowser),
Prompt Box (fetch value from user and display on browser).

Alert Box

Alert Box simply display a message to user on browser.

Syntax

alert("Any message text");

Example

<input type="button" onclick="alert('Wow.. This example represent alert box.');" value="Open Alert Box" />

Run it...   »

Example Result

Confirm Box

A confirm box is often use to verify or accept some confirm message and display on browser. When a confirm box display on browser, the user allow to click either "OK" or "Cancel" to proceed.

Syntax

confirm("Are you sure to perform this action.");

Example

<input type="button" onclick="confirm('Are you sure you want to learn next chapter?')" value="Open Confirm Box" />

Run it...   »

Example Result

Prompt Box

A Prompt Box is often use to get a value from user (means input to the value from user) and after value using the specify purpose can be process.

Syntax

prompt("Enter some value","default value");

Example

<input type="button" onclick="prompt('Enter your lucky digit number', '2 ');" value="Open Confirm Box" />

Run it...   »

Example Result