similar to Mark's, but what I usually do it fire the "delete" functionality from the server.
Therefore, by modifying his JavaScript a smidge:
btn.Attributes["onclick"] = "javascript: return confirm('Do you want to delete?');";
By passing the confirm (which gives a true/false value as a result) directly to the onclick handler, if you return a cancel/false attribute, the onclick doesn't complete and the form submittal will not occur.