Displaying Confirm window for user inputWe can display a confirm box to the visitor and ask their opinion. This confirm window will have two buttons, one for OK and other for CANCEL. Visitor can click one if the two buttons and the user action can be captured by assigning this to a variable. The confirm box will return TRUE if the OK button is clicked and it will return FALSE if cancel button is clicked.
We check the return value by using if else condition checking
We can further improve this by linking the returned value of the confirm button to an alert window.
Here is the code for a confirm box linked to an alert window.