[thelist] js alert to confirm deletion

lon.kraemer lwkraemer at directvinternet.com
Tue Sep 24 14:52:01 CDT 2002


> I have a link in a PHP page that reloads that page (with all the query
strings
> as well) and tacks on an extra query:
>
> <?php
> $current_url = $_SERVER['REQUEST_URI'];
>
> ...
>
> <a href="$current_url&amp;DelPic=$imageid" title="Delete this
image">delete</a>
> ?>
>
> And then some logic happens using the DelPic value.
>
>
> 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.

<a href="$current_url&amp;DelPic=$imageid" title="Delete this image"
onclick="return confirm('Are you sure?');">delete</a>

Of course, users with JS off will not get the confirmation dialog.

--
Lon Kraemer
-----------------------------------------




More information about the thelist mailing list