Sunday, October 19, 2008

How to use Confirm box?

We have confirm function in javascript simillar to alert in javascript.
alert box just provides a message box with only "OK" button.
Confirm box provides a message box with "OK" and "Cancel" buttons.

There might be certain requirements to handle this ok and cancel events.That is to handle the ok/cancel button click events.

When user clicks on "OK" button , it returns true (boolean) and for "cancel" it returns false (boolean).
So following execution is an example to handle such confirm box.

Example:-

function test()
{
if(confirm('Are you male?'))
alert('You are Male');
else
alert('You are Female');
}

This says, when user clicks on "OK" button which is on the confirm box (Accepting that user is male) displays an alert box saying "You are Male" else displaya an alert box saying "You are Female".

1 comment:

Anonymous said...

give me basic concepts of mySQL database also..thank u