# Help me with javascript confirmation alert

**URL:** <https://forum.kirupa.com/t/help-me-with-javascript-confirmation-alert/244134>\
**Category:** programming\
**Created:** [November 14, 2007, 4:53pm UTC](https://forum.kirupa.com/t/help-me-with-javascript-confirmation-alert/244134 "2007-11-14T16:53:35Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![tsd](https://avatars.discourse-cdn.com/v4/letter/t/7ba0ec/32.png) [@tsd](https://forum.kirupa.com/u/tsd)\
**Post date:** [November 14, 2007, 4:53pm UTC](https://forum.kirupa.com/t/help-me-with-javascript-confirmation-alert/244134/1 "2007-11-14T16:53:35Z")

</div>

Hello,  
I need some help with this script:

```auto
<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:

```auto
<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
