Simple Confirmation Code for a Delete Button

L

Les Juby

I've used a simple javascript for some time (no entries required up in
the <head> tag) that asks for a confirmation before deleting.

ie.
<a href="/delete.asp?which=345 %>" onclick="javascript:return
confirm('Are you ABSOLUTELY SURE you want to DELETE this record
?')">Delete record</a>

On several sites I use short form constructs to generate a more
recognizable button, and would like to use a simple script such as
this to give the conformation option.

ie.
<form action="delete2.asp" method="post">
<input type="hidden" name="which2" value=345">
<input type="submit" value="Delete">

Could this script be modified.?

Any alternative.?

.les.
 
L

Les Juby

onclick="javascript:return
confirm('Are you ABSOLUTELY SURE you want to DELETE this record
?')"

OK. I worked it out......

onclick gets replaced by onsubmit !!!!

.les.
 
P

Phat G5 (G3)

I've used a simple javascript for some time (no entries required up in
the <head> tag) that asks for a confirmation before deleting.

ie.
<a href="/delete.asp?which=345 %>" onclick="javascript:return
confirm('Are you ABSOLUTELY SURE you want to DELETE this record
?')">Delete record</a>

On several sites I use short form constructs to generate a more
recognizable button, and would like to use a simple script such as
this to give the conformation option.

ie.
<form action="delete2.asp" method="post">
<input type="hidden" name="which2" value=345">
<input type="submit" value="Delete">

Could this script be modified.?

Any alternative.?

.les.
Sure it could.

Either

<form action="delete2.asp" method="post" onsubmit="return confirm('Are you
ABSOLUTELY SURE you want to DELETE this record ?');">

OR

<input type="submit" value="Delete"onclick="javascript:return
confirm('Are you ABSOLUTELY SURE you want to DELETE this record ?')">


HTH,

--Steffan
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top