Question : JavaScript "Are You Sure" Pop up that executes code if "Yes"

Hello experts:

I am using Classic ASP and VBScript and MySQL.

I have this to delete a record:

1:
2:
3:
4:
5:
6:
7:
8:
9:
 
MySQL = "Delete FROM mytable WHERE id=" & RecordID
     Set RS = Con.Execute(MySQL)

     Response.Redirect "/listings/index.asp?action=list"
	 
		  '*** Close the Database Connection.
		     Con.Close
			 Set Con = NOTHING	


What I cannot figure out is when they click the DELETE link, there should be a pop-up that says, "Are You Sure You want to Delete This Record?"

If they say "Yes" then the record would be deleted (the above code) but if they say "No" then they would be taken back to the listings page without making any changes.

Any help will be greatly appreciated.

Regards,

--d.

Answer : JavaScript "Are You Sure" Pop up that executes code if "Yes"

I left a word out of it.  Try this instead.
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
<html>
<head>
<script type="text/javascript">
function show_alert()
{
return confirm("Are you sure?");
}
</script>
</head>
<body>
<h1>js-confirm.html</h1>
<a href="js-confirm2.html" onclick="return show_alert()">Delete</a><br /><br />

</body>
</html>
Random Solutions  
 
programming4us programming4us