JavaScript confirmation boxes can be a handy way to give our
visitors an alternative of whether or not an action is performed. JavaScript confirmation
box will pop up much like an
JavaScript alerts, but will allow the viewer to press an
"OK" button or "Cancel" button. Here is the necessary command for creating a confirmation box.
The difficulty is, if we use just that it isn't very handy to reuse of capture
the user action.
The JavaScript confirmation boxes will return a value of
True or
False, so this is
what we must use to make use of the JavaScript confirmation box. An easy way to get
the value for later use is to assign it to a
JavaScript variable, like the below code for JavaScript Confirmation box
capturing the returned value.
Now, here we can use the respOfConfirmation a
JavaScript variable to
examine what the visitor
responding to this
JavaScript alert. Here action is depending on the value the
JavaScript confirmation box returned
on behalf of user action. We can do this with an
if/else statement block like below code
we are handling JavaScript Confirmation response using
JavaScript conditional
statement [if/else].
Now use the above JavaScript Confirmation box, its capturing and handling code in the body of our web page like this.
When the page will be loaded or refreshed then visitor can have the below screen shore in front of him.

