The Dialogs class contains static methods for three different types of user dialogs - information, confirmation and input.
The showInfoDialog method shows a dialog, displaying a custom message and an OK button. This type of dialog is used for displaying some information to the user.
You can specify the message and the title text, the Dom element to append the dialog to, and the css theme.
JavaScript Copy Code |
---|
var today = new Date(); function calculateTime (startTime) |
The showConfirmDialog method shows a dialog, displaying a custom message and OK and Cancel buttons. This type of dialog is used for handling user choice.
You can specify the message and the title text, the Dom element to append the dialog to, and the css theme.
JavaScript Copy Code |
---|
var infoMessage; = ""; // show the dialog //the callback function |
A callback function can be specified, which will be invoked when the dialog is closed. The dialog's modal result will be set accordingly, depending on which button has been clicked to close the dialog, and its value will be accessible as an argument of the callback function.
The showInputDialog method shows a dialog, displaying a custom message, custom input control and OK and Cancel buttons. This type of dialog is used for handling user input.
You can specify the message and the title text, the Dom element to append the dialog to, and the css theme. Additionally, you can choose the type of the input control and the property, whose value will be monitored. If these parameters are not specified, the dialog will show a default empty HTML text input and will monitor its value property.
JavaScript Copy Code |
---|
// create a custom input for the input dialog var option = document.createElement("option"); option = document.createElement("option"); // show the dialog |
A callback function can be specified, which will be invoked when the dialog is closed. The dialog's modal result will be set accordingly, depending on which button has been clicked to close the dialog, and its value will be accessible as an argument of the callback function. The dialog's result will be set to the value of the monitored property and it will be passed as the second argument to the callback function.