Simple Javascript Delete Confirmation
This entry was posted on Aug 09 2007
Put this in between the tags...
JavaScript:
-
function confirmDelete(delUrl) {
-
if (confirm("Are you sure you want to delete this item?")) {
-
document.location = delUrl;
-
}
-
}
... and make your delete link look like this...
HTML:
-
<a href="javascript:confirmDelete('?param1=1&item=4')">some link</a>
Enjoy.
Meshach

Or:
pseudocode:
confirmDelete(this);
in confirmDelete:
if are you sure
go to this.href + '?delete=1' (or &delete=1 if there already is ? in the url)
if users don't have js they will instead see a confirmation page (because there is no ?delete=1 in the orig url)