Wednesday, December 31, 2008

Javascript Confirm Box

The Javascript confirm box differs from a regular alert box in that, it provides two choices for the user: 'OK' and 'CANCEL' to confirm or reject the request. The confirm statement takes a string that will be displayed with the text box along with the OK and the Cancel Button. In addition it will return a value. The returned value will be true if OK button is pressed. The returned value will be false if Cancel button is pressed. We can use a variable and an if statement to determine if the 'OK' or 'CANCEL' button is clicked..

Let us look at the example that simply displays a confirm box and diplays an alert box with a message "You said :OK" if the user presses OK button. It will display an alert box with a "You said : Cancel", if the user presses Cancel Button.
http://www.referencedesigner.com/tutorials/js/js_9.php

No comments: