JavaScript Notes: POP UP BOX| PDF | B.Tech
top of page

JavaScript Notes: POP UP BOX

Updated: Oct 16, 2022

Mobiprep has created last-minute notes for all topics of Javascript to help you with the revision of concepts for your university examinations. So let’s get started with the lecture notes on javascript.

Our team has curated a list of the most important questions asked in universities such as DU, DTU, VIT, SRM, IP, Pune University, Manipal University, and many more. The questions are created from the previous year's question papers of colleges and universities.

JavaScript Notes: Pop up Box


Question 1. What is a Pop up box?

For showing a warning or any other important information to website visitors Popup boxes are used. There are three types of popup box available to use in JavaScript. They are as follows :

  • alert()

  • confirm()

  • prompt()

alert() - JavaScript Message Box To inform or alert the user by displaying some messages in a small dialogue box alert box is used. The alert() method doesn't have an object name in front of it, because the alert() method is part of the window Object .User will have to click "OK" to proceed when an alert box pops up. confirm() - To let the user make a choice confirmation box is used . The user will have to click either "OK" or "Cancel" to proceed the next step when Javascript pops up a confirm box. Depending on what button the user clicks different actions will occur. These course of action can be specified with conditional logic. prompt() - Javascript Prompt Box is used when you want the user to enter an input value before proceeding to the next step. The user should click either "OK" or "Cancel" to proceed after entering an input value when Javascript displays a prompt box. Depending on what exactly the user does with the dialog, the return value of prompt box will be decided. The user input string will be returned by prompt method if the user types something, then clicks OK or presses Enter. 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 by clicking Cancel or pressing Esc or any cancelation action , then in most browsers the prompt method returns null.


Question 2. What is the difference between confirmation box and alert box?

Alert Box

​Confirmation Box

An alert box displays only one button i.e. OK button

Confirmation box displays two buttons i.e. OK and CANCEL button.

When user enter something wrong according to site alert box will be pop up.

When user information or query is successfully summitted to serve conformation box will pop up.

The alert() dialog box is used to communicate a message to the user.

The confirm dialog box used for confirmation of a user's answer to a question.

Used by developers to debug their applications.

This can be used in shopping cart applications just before placing the order or on file sharing sites just before you delete a file.




 

Mobiprep is a one stop solution for all exam preparation needs. Get all exam prep resources at a single platform.
Free Practice Tests
Top Placement Interview Questions
Top Placement MCQ's Questions
 


58 views0 comments

Recent Posts

See All
bottom of page