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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can a JavaScript function be called form a link? 1

Status
Not open for further replies.

amisima

Programmer
Jun 11, 2003
13
0
0
CA
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
 
<a href=&quot;somePage.asp&quot; onClick=&quot;return confirm('Are you Sure')&quot;>some link</a>

Programming today is a race between software engineers striving to build better and bigger idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. - Rick Cook
 
How would I add the on click if I have a link like this
<%Response.Write (&quot;<a href=&quot;&quot;CATS_Term_Record_Deleted.asp?ID_no=&quot; & rs(&quot;term_ID&quot;) & &quot;&quot;&quot;>&quot;)%>
<td><b>{EN}</b></td>
<td><b><%Response.Write (rs(&quot;title&quot;)) %></b></td>

thanks,

Amisima
 
Your link doesn't make sense. There is not closing </a> tag.

Is this what you mean?

<td><b>
<%Response.Write (&quot;<a href=&quot;&quot;CATS_Term_Record_Deleted.asp?ID_no=&quot; & rs(&quot;term_ID&quot;) & &quot;&quot;&quot; onClick=&quot;&quot;return confirm('Are you sure?')&quot;&quot;>&quot;)%>
<%Response.Write (rs(&quot;title&quot;)) %>
</a>
</b></td>


Programming today is a race between software engineers striving to build better and bigger idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. - Rick Cook
 
Yes that is what I meant. I didn’t have an </a> tag. I forgot to include it.

Thank you for all your help!

I have another question if that is ok.

I have this update page. The user enters in a record to be updated on a form. The page then displays the record to be updated. I am trying to add a error message to check if what the user typed in doesn't match anything in my database. I have an if statement to do the error checking. It works when the user enters in a record that doesn't match one in my database. The if statement fails when the user enters in a record that matches in the database. The error message &quot;that record doesn't exist!!&quot; appears when the records do match, the matching record appears along with the error message. Here is my if statement. Can anyone help?

if trim(ucase(request.form(&quot;frm_title&quot;))) <> trim(ucase(rs.fields(&quot;title&quot;))) then
response.write(&quot;that record doesn't exist!!&quot;)
%><br><%
end if

also tryed to
If rs.EOF = True Then
response.write(&quot;that record doesn't exist!!&quot;)
end if

but nothing worked.

Amisima
 
set rs = cn.execute(&quot;select * from myTable where title like '&quot; & uCase(request(&quot;title&quot;)) & &quot;'&quot;

if rs.eof then
response.write(&quot;that record doesn't exist!!&quot;)
end if

Programming today is a race between software engineers striving to build better and bigger idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. - Rick Cook
 
that looks fairly familiar [flame]

_____________________________________________________________________
onpnt2.gif

[bdaycandle]
 
I wonder if amisima will buy it this time or ask again.
 
if you're lost like i was, see thread333-629672 ..

Posting code? Wrap it with code tags: [ignore]
Code:
[/ignore][code]CodeHere
[ignore][/code][/ignore].
 
and here's another method to call a javscript function in a link. this is just for info sake...
<a href=&quot;javascript:FunctionName()&quot;>Link</a>

Known is handfull, Unknown is worldfull
 
hey veep,

what is &quot;I wonder if amisima will buy it this time or ask again.&quot; supposed to mean?
 
Hi onpnt,

Sorry I was just looking for some different answers to my questions.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top