I have a submit button which deletes some checked out records on my web page.

Now I want to add a messagebox before deleting the records, but somehow it is not working.
Upon selection of either of 'ok' and 'cancel' , it is deleting the record. How can I make sure that
delete only when 'ok' is pressed and 'Do not' delete when 'cancel' is pressed ?

Following is my code :

$cgi->submit(-label => "Remove selected records", -onClick => 'confirmBeforeDeletion()');

function confirmBeforeDeletion 
   var con = confirm("Are you sure to delete");
   if(con == true)
These above javascript function is not taking the appropriate action which I want. In both cases if and else, it is deleting the record.

Please help.