Net-informations.com
SiteMap  | About    

JavaScript Popup Boxes

Popup boxes are the most useful way of showing a warning or any other important information to website visitors. JavaScript has three different types of popup box available for you to use. They are:

  1. alert()
  2. confirm()
  3. prompt()

alert() - JavaScript MessageBox

An alert dialog box is mostly used to inform or alert the user by displaying some messages in a small dialogue box. It is important to note that the alert() method doesn't have an object name in front of it, because the alert() method is part of the window Object . When an alert box pops up, the user will have to click "OK" to proceed.

Syntax



Source

JavaScript Confirm() Box

A confirmation box is used to let the user make a choice. When Javascript pops up a confirm box , the user will have to click either "OK" or "Cancel" to proceed the next step. Different actions will occur depending on what button the user clicks. You can specify this course of action with conditional logic.

Syntax



Source

JavaScript prompt Box

The alert() method can not interact with the visitor. Javascript Prompt Box is often used if you want the user to enter an input value before proceed to the next step. When Javascript display prompt box , the user will have to click either "OK" or "Cancel" to proceed after entering an input value. The value returned by prompt depends on what exactly the user does with the dialog. If the user types something and then clicks OK or presses Enter, the prompt method returns the user input string. If the user clicks OK or presses Enter without typing anything into the prompt dialog , the method returns the suggested input, as specified in the second argument passed to prompt. If the user dismisses the dialog (e.g. by clicking Cancel or pressing Esc), then in most browsers the prompt method returns null.



Source









net-informations.com (C) 2017    Founded by raps mk
All Rights Reserved. All other trademarks are property of their respective owners.