Dialogue boxes are a kind of popup notification, this kind of informative functionality is used to show success, failure, or any particular/important notification to the user.
Alert Box: An alert box is used on the website to show a warning message to the user that they have entered the wrong value other than what is required to fill in that position
function Warning() {
alert ("Warning danger you have not filled everything");
console.log ("Warning danger you have not filled everything");
}
Confirm box: A confirm box is often used if you want the user to verify or accept something. When a confirm box pops up, the user will have to click either “OK” or “Cancel” to proceed. If the user clicks on the OK button, the window method confirm() will return true.
function Confirmation() {
var Val = confirm("Do you want to continue ?");
if (Val == true) {
console.log(" CONTINUED!");
return true;
} else {
console.log("NOT CONTINUED!");
return false;
}
}
Prompt Box: A prompt box is often used if you want the user to input a value before entering a page. When a prompt box pops up, the user will have to click either “OK” or “Cancel” to proceed after entering an input value. If the user clicks the OK button, the window method prompt() will return the entered value from the text box.
function Value(){
var Val = prompt("Enter your name : ", "Please enter your name");
console.log("You entered : " + Val);
}