Core JavaScript

Intermediate JavaScript

JavaScript Reference

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("Some_Message_Text");

Example-Code:

<input type="button" 
onclick="alert('Wow.. This Example is Alert Box Effect...!');"  
value="Alert Box Example" />

Example-Results:


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("Some_Message_Text");

Example-Code:

<input type="button" 
onclick="confirm('Are you sure you want to Learn Next Chapter?');"  
value="Confirm Box Example" />

Example-Results:


Prompt Box

A Promt Box os 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("Some_Message_Text","By_Default_Value");

Example-Code:

<input type="button" 
onclick="prompt('Please Enter your Favorite Web Master Tutorial 
Website:', 'www.Way2Tutorial.com');"  value="Prompt Box Example" />;

Example-Results: