How can I prompt a user to confirm critical actions like deleting records?


Use the javascript confirm() function. It looks similar to the alert() box, but has an OK and a CANCEL button.
If the user clicks OK, confirm() will return true.
Otherwise - escape, or click on CANCEL - it will return false.

<script language="JavaScript">
function confirm_entry(user_name, delete_url)
input_box=confirm("Do you really want to delete user " + user_name);
if (input_box==true) { 
  // clicked 'OK', so delete the record

<a href="javascript:confirm_entry('peter', '/cgi-bin/')">delete peter</a>

Content-type: text/html


2008-02-01, 19:49:59
anonymous from United States  
Yes ,I am from Cambridge US

I have a problem to submit online a document. My computer(Macos9) brand new keep telling me 'Javascript:ask for confirmation'. I don't really know how to to that and I can't submit my document until I fix this problem.So read your explanation but I am still confused. Could you technically tell me what to do?
Thank you for consideration
2011-12-28, 23:38:37
anonymous from Baku, Azerbaijan  




NEW: Optional: Register   Login
Email address (not necessary):

Rate as
Hide my email when showing my comment.
Please notify me once a day about new comments on this topic.
Please provide a valid email address if you select this option, or post under a registered account.

Show city and country
Show country only
Hide my location
You can mark text as 'quoted' by putting [quote] .. [/quote] around it.
Please type in the code:

Please do not post inappropriate pictures. Inappropriate pictures include pictures of minors and nudity.
The owner of this web site reserves the right to delete such material.

photo Add a picture: