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

5 Apr, 2008  |  Adaugat de noru 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>
Adauga
  • FTW.ro
  • Problogger.ro

450 afisari

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="">

Do NOT fill this !

 
TRAFIC TRIPUL - Director Web

94 queries. 1.327 seconds.