[thelist] js alert to confirm deletion

Anthony Baratta Anthony at Baratta.com
Tue Sep 24 15:11:01 CDT 2002


At 12:38 PM 9/24/2002, Dunstan Orchard wrote:

><a href="$current_url&amp;DelPic=$imageid" title="Delete this
>image">delete</a>
>
>I'd like to put a JS alert in there so that the user has to click on it to
>confirm they want the delete to go ahead. And if the click 'NO' then the page
>stays as it was.

in your href put something like this:

onclick="verifyDelete();"

Then somewhere on your page:

<script language="javascript" type="text/javascript">
function verifyDelete() {
    if (confirm("Are you sure you want to delete this image?")) {
       return true;
    } else {
       return false;
    }
}
</script>

You can read more about the confirm function here:

http://developer.netscape.com/docs/manuals/js/client/jsref/window.htm#1201914
---
Anthony Baratta
President
Keyboard Jockeys

"Conformity is the refuge of the unimaginative."




More information about the thelist mailing list