Print Page | Close Window

can JavaScript being called from a link

Printed From: Web Wiz Forums
Category: General Discussion
Forum Name: Classic ASP Discussion
Forum Description: Discussion on Active Server Pages (Classic ASP).
URL: https://forums.webwiz.net/forum_posts.asp?TID=4993
Printed Date: 30 March 2026 at 1:26pm
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: can JavaScript being called from a link
Posted By: amisima
Subject: can JavaScript being called from a link
Date Posted: 13 August 2003 at 12:33pm
Hi,

Does anyone know if there is such a thing as a JavaScript function being called from a link?

I have a delete page, the user types in a word to be deleted form the oracle database. The page then displays the record as a link. The user clicks the link and the record is deleted. I want to have an alert "Are you sure you want to delete?" when the user clicks on the link. Has anyone come across this before?

Thanks,

Amisima



Replies:
Posted By: MorningZ
Date Posted: 13 August 2003 at 12:42pm
<a href="whateverthelinkistodelete" onClick="return confirm('Are you sure you want to delete?')">Link Text</a>

-------------
Contribute to the working anarchy we fondly call the Internet


Posted By: amisima
Date Posted: 13 August 2003 at 12:54pm
Thank you for your guick response.
I tryed to add the on click to my link but I got errors. This is my link with out the on click

<%Response.Write ("<a href=""CATS_Term_Record_Deleted.asp?ID_no=" & rs("term_ID") & """>")%>
        <td><b>{EN}</b></td>
        <td><b><%Response.Write (rs("title")) %></b></td>

this is what I have tryed
<%Response.Write ("<a href=""CATS_Term_Record_Deleted.asp?ID_no=" & rs("term_ID") & onClick="return confirm('Are you sure you want to delete?')"""">")%>

this is my result with the on click

False ' {EN} test
False ' {EN} test

can you give me any advice?

thanks,

amisima


Posted By: MorningZ
Date Posted: 13 August 2003 at 1:05pm

yuck.. you can be a lot neater than that when writing code..

try:

<a href="CATS_Term_Record_Deleted.asp?ID_no=<%= rs("term_ID") %>" onClick="return confirm('Are you sure you want to delete?')">

in your code, you didnt close the "href" parameter



-------------
Contribute to the working anarchy we fondly call the Internet



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.08 - https://www.webwizforums.com
Copyright ©2001-2026 Web Wiz Ltd. - https://www.webwiz.net