Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to display confirm dialog? 1

Status
Not open for further replies.

gizmicek

Programmer
Jun 25, 2003
107
CZ
Hi all,
this is probably very simple for you but I'm not working with JS so I'm asking for help. I have php application and have one link linking to the script which erases some data from database. I want to avoid my users to click this link accidentaly so I'd like to display some messagebox containing the message "Do you really want to..." and the "yes" and "no" buttons. Which JS function call will do the job and how can I check the return value (whether the user clicked 'yes' or 'no')?

Any help will be appreciated.
 
there you go:

<a href=&quot;if(confirm('Are you sure you want to delete?'))window.location='url of the processing page if they select yes'&quot;>
 
ok thats work fine when I do this:
Code:
<a onclick=&quot;if(confirm('Are you sure you want to delete?'))window.location='blah.php'&quot;>
but I also need to make the link active so there must be the href attribute in the tag. When I set the href attribute, browser is redirected to that page even when the javascript redirection is performed.

Any suggestions?
 
like jemminger said

<a href=&quot;#&quot; onclick=&quot;if(confirm('Are you sure you want to delete?'))window.location='url of the processing page if they select yes'&quot;>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top