Knowledge Walls
Laya
Hyderabad, Andhra Pradesh, India
window.confirm() Method in Window Object of Javascript Syntax with Examples
2852 Views
Usage 
Confirm() method is used to display a dialog box which is used to get input ( yes or cancel) from the user.
Syntax 
confirm(message);
Example
if (confirm ("Are you 18+")) {
   document.write("You are allowed for the next stage");
}
else {
   document.write("You are not allowed!");
}
Output 
Pop up message will come to get input for user (ok or cancel) and then display below message.

If Ok then 
"
You are allowed for the next stage"

Cancel then
"
You are not allowed"
Best Lessons of "Javascript Syntax with Examples"
Top lessons which are viewed more times.
  Copyright © 2014 Knowledge walls, All rights reserved
KnowledgeWalls
keep your tutorials and learnings with KnowledgeWalls. Don't lose your learnings hereafter. Save and revise it whenever required.
Click here for more details