In JavaScript, the programmer has some interesting options regarding native feature, some of them are very helpful especially for simple functions of daily interaction with the user that some pages may need. The command ALERT, CONFIRM AND PROMPT are clear examples of this type of resource.


The dialog ALERT serves to show an information and only has a button to close. This feature is often used to display messages to the user possible, especially in cases where there are errors in filling out forms or information processing. See below for an example of code ALERT:

<SCRIPT LANGUAGE=”javaScript” type=”text/javaScript”>
alert (“Hello, this is an ALERT box.”)


Unlike ALERT, CONFIRM the box returns a Boolean value (true or false) for that particular action is performed. Using the buttons “OK” and “Cancel” certain action can be performed, just that an IF is created validating the information returned from CONFIRM, check below a practical example:

<SCRIPT LANGUAGE=”javaScript” type=”text/javaScript”>
var = return confirm(“Choose an option.”);

if (back) {
alert (“You clicked on OK button!”);
}else {
alert (“You clicked on Cancel button”);


This dialog box is used to test more code blocks, from a data entry user can perform certain processing. This feature has been replaced by text fields, so you will hardly use it on a daily basis, but nevertheless it is important to know what this feature does. Check out the example:

<SCRIPT LANGUAGE=”JavaScript” type=”text/JavaScript”>
var name;
do {
name = prompt (“What is your name?”);
} While (name == null | | name == “”);
alert (“Your name is” + name);


There are countless resources that JavaScript language features, so it is important to understand well on its operation. Often a problem can be solved with a simple method exists in the native language.

Want to test our examples and still learning how to use other features of a web development tool more powerful in the world? Then download the free version now Scriptcase and meet a world of possibilities.

By ,

August 12, 2013


You might also like…

5 reasons you can’t miss a Black Friday Scriptcase!

This November we bring you the biggest and most important discounts of the year! And do you know wh...

Taking a look at Scriptcase version 9.7

After the big Scriptcase 9.7 presentation event, we have a new version of Scriptcase for download, ...

October Newsletter

Follow the latest news for the month of October! Webinars, blog posts, videos, and more. WEB...

You might also like…

Get new posts, resources, offers and more each week.

We will use the information you provide to update you about our Newsletter and Special Offers. You can unsubscribe any time you want by clinck in a link in the footer of any email you receive from us, or by contacting us at Learn more about our Privacy Police.