postimg
Dec 2008 04

JavaScript Confirm Delete0

Posted In JavaScript By Tony Virelli

Use a javascript alert box to confirm that a user really wants to continue with the action.

<script type="text/javascript">// <![CDATA[
function confirmDelete(delUrl) {
    if (confirm("Are you sure you want to delete")) {
        document.location = delUrl;
    }
}
// ]]>
</script>
<a href="javascript:confirmDelete('delete.page?id=1')">;Delete</a>

Another way to do this is

<a onclick="return confirm('Are you sure you want to delete?')" href="delete.page?id=1">Delete</a>
Share and Enjoy:
  • Print
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks
  • Blogplay
  • email
  • LinkedIn
  • MySpace
  • PDF
  • Reddit
  • RSS
  • Slashdot
  • StumbleUpon
  • Technorati
  • Twitter

Leave a comment

Get Adobe Flash playerPlugin by wpburn.com wordpress themes