Help me with javascript confirmation alert

Hello,
I need some help with this script:

<script type="text/javascript">
<!--
function confirmation() {
    var answer = confirm("are you sure to delete the record?")
    if (answer){
        alert("ok!")
    }
    else{
        alert("cancel!")
        return false;
    }
}
//-->
</script>

and the link to call the function is:

<a href=\"category_delete.php?delcode=$rows[0]\" target=\"_self\" onclick=\"confirmation()\"><img src=\"images/delete.gif\" width=\"16\" height=\"16\" border=\"0\" /></a>

I want to stop the javascript function if the user click on “cancel” of the alert window.
I use return false; but is not working.

Thanks in advance,
Nick