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.

You might also like…

Basic Software Security Concepts Part 2

In the design phase, many critical and strategic decisions of software security architecture are tak...

Importing the Bootstrap library into the Scriptcase

In this article we will show you a practical example about to make the Bootstrap library available i...

Using the sc_redir and sc_apl_conf macros

Macros on Scriptcase is the same as in any other programs, it is a saved sequence of commands or key...

Comment this post

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