473,421 Members | 1,625 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,421 software developers and data experts.

Confirmation message box on a link click?

Hi,

I'm working on a PHP FTP client, but my testers have complained the delete file
link is too easy to hit by mistake. Would it be possible/plausible to write a
bit of javascript that pops up a confirmation when they click the link, that
goes to a certain page if they click yes and does nothing if they click no?

I have no idea if this is tough or not. Any help with this would be greatly
appreciated.

Regards,
Craig
Jul 20 '05 #1
3 24152
On Wed, 18 Feb 2004 20:29:32 +0000, Craig <cr*******@hotmail.com> wrote:
I'm working on a PHP FTP client, but my testers have complained the
delete file link is too easy to hit by mistake. Would it be
possible/plausible to write a bit of javascript that pops up a
confirmation when they click the link, that goes to a certain page if
they click yes and does nothing if they click no?


This is fairly simple to do, but very unreliable: if JavaScript is
disabled, there will be no confirmation option. The best thing to do would
be to list on a new page all of the files and directories that will be
deleted (or a summary of them), then get the user to confirm the deletion
that way.

If you still want to proceed with a JavaScript method:

<a href="delete.php"
onclick="return confirm('Are you sure?');">Delete</a>

Mike

--
Michael Winter
M.******@blueyonder.co.invalid (replace ".invalid" with ".uk" to reply)
Jul 20 '05 #2
Michael Winter wrote:
On Wed, 18 Feb 2004 20:29:32 +0000, Craig <cr*******@hotmail.com> wrote:
I'm working on a PHP FTP client, but my testers have complained the
delete file link is too easy to hit by mistake. Would it be
possible/plausible to write a bit of javascript that pops up a
confirmation when they click the link, that goes to a certain page if
they click yes and does nothing if they click no?

This is fairly simple to do, but very unreliable: if JavaScript is
disabled, there will be no confirmation option. The best thing to do
would be to list on a new page all of the files and directories that
will be deleted (or a summary of them), then get the user to confirm the
deletion that way.

If you still want to proceed with a JavaScript method:

<a href="delete.php"
onclick="return confirm('Are you sure?');">Delete</a>

Mike


Yea I had a think and decided I do wanna go with the javascript. At the end of
the day if a user deletes a file by mistake when the alert doesnt popup its
still their own fault. The link is very clealy labelled, after all.

So that works a treat. Thanks!
Jul 20 '05 #3
<html><head><title>href confirm</title>
<script type="text/javascript">
function linkRef(yurl ){
var linkref = yurl;
if(confirm("do you really want to go here?")){
window.location.href=linkref;
}
}
</script>
</head>
<body>
<a href="#" onClick="linkRef('http://www.yahoo.com' )">Yahoo.com</a>
</body>
</html>
Jul 20 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: ScooterMX | last post by:
I have a <a href="javascript:top.window.close()"><img src="exit.gif"></a> tag on my page that closes itself when you click on it. What I NEED is for it to put up a confirmation message that...
6
by: Nedu N | last post by:
Hi, I want to have confirmation(Yes/No) on a button of the webform in which there are many validation controls. I want all the validation controls to be triggered first and then Yes/No...
6
by: Dave | last post by:
Hello. I want to prompt user for some action with Yes/No message, I know some tricks in JavaScript, but I need to handle the user answer at server side. Exactly I want to prompt user for...
3
by: Imran Aziz | last post by:
Hello All, I have a delete link on my page, which when clicks calls the URL for deletion, in ASP we use to create a java script confirm box to confirm delete, how can that be done in ASP? Say if I...
11
by: Prince of Code | last post by:
Hey There, I have been to this group for a couple of days. I am really impressed by the way people respond. I get answers for all my doubts and that too more info. So I am putting across a doubt...
1
by: almarc | last post by:
Problem : Stop an "Unonlaod" when then confirmation is false. Is a really good script but i have just one problem. The problem that i have is when i click on a link. The scipt ask "Do you want to...
2
by: .Net Sports | last post by:
I'm using CDO mail in my asp scripts, and I need to find a script that whereas a user signs up for your website and when he hits submit, an email goes to his email box with a confirmation link for...
2
by: bay_dar | last post by:
Hi, I have an internal ASP.NET application that I'm are using to send e-mails out based on a single milepost or milepost range entered. I'm trying to do two things when a user clicks on the...
2
by: kaka | last post by:
I am developping a sns site. I was wondering if i send user's email addresses as a part of confirmation link so that when a user receives the confirmation email, he can just click on the link to...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.