JavaScript Popup Boxes

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

JavaScript Alert Box

JavaScript 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

JavaScriptConfirm Box

JavaScript 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

JavaScript Prompt Box

JavaScript 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