I have a delete confirmation javascript that is supposed to cancel the delete if the user chooses. It is deleting the record no matter what choice the user picks.
Here is the delete hyperlink the user is clicking to invoke this:
The confirmation comes up just fine but it doesn't matter if I click OK or CANCEL it deletes the record. I don't know javascript that well so if any can point out my mistake I would appreciate it.
Thanks
Code:
<script language="JavaScript">
var intAnswer;
function DeleteAccount(ID,FIRST,LAST) {
intAnswer = window.confirm("Delete Account: " + FIRST + " " + LAST + " ?");
if (intAnswer == 1) {
window.location.replace("Diabetics_Main.asp?CMD=Delete&ID=" + ID);
}
return false;
}
</script>
Here is the delete hyperlink the user is clicking to invoke this:
Code:
Response.Write "<td><a onClick=""DeleteAccount(" & RS.fields("ID") & ", '" & RS.Fields("FirstName") & "', '" & RS.Fields("LastName") & "')"" style=""text-decoration: none; color: navy; font-size: 8pt"" href=""Diabetics_Main.asp?CMD=Delete&ID=" & RS.Fields("ID") & "&" & uUrl & """>Delete</a></td>"
The confirmation comes up just fine but it doesn't matter if I click OK or CANCEL it deletes the record. I don't know javascript that well so if any can point out my mistake I would appreciate it.
Thanks