Javascript – Confirm box to ask the user if they want to delete

5 Apr, 2008   Adăugat de in javascript, programare | 

Put this in your head section of your file :

1
2
3
4
5
6
7
<script>
function confirmDelete(delUrl) {
  if (confirm("Are you sure you want to delete")) {
    document.location = delUrl;
  }
}
</script>

And further down in the page :

<a href="javascript:confirmDelete('delete.page?id=1')">Delete</a>

Another way:

<a href="delete.page?id=1&phpMyAdmin=8rAC-HitBaaKjjuJK6I5aeNI-Ea" onclick="return confirm('Are you sure you want to delete?')">
Delete
</a>

No Responses so far | Have Your Say!

Leave a Feedback

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="" highlight="">

 

63 queries. 0.509 seconds.