-
Java Script in ASP
This may sound a bit odd, but I am trying to mix JavaScript onclick event into ASP.
I have ASP code to make a list of links from a database, that code looks like this
Code:
Response.Write "<a href=""" & recordset("url") &""" title=""" & recordset("name") &""">" & recordset("name") & "</a>"
Is it possible to have the same kind of system that uses this JavaScript
Code:
<a href="URL"
onclick="window.open(this.href); return false;"
onkeypress="window.open(this.href); return false;" title="Name">Name</a><br>
I can never get the " and ' bits right
-
Re: Java Script in ASP
I assume the bolded parts are where you want the ASP to take over. Try...
Code:
<a href="<% Response.Write URL %>"
onclick="window.open(this.href); return false;"
onkeypress="window.open(this.href); return false;" title="<% Response.Write NAME %>"><% Response.Write NAME %></a><br>
-
Re: Java Script in ASP
Yes the bold parts are where the record set bits are in the other bit of code I posted.
I will give the above a try.
-
Re: Java Script in ASP
Great, got it working, thanks :D
-
Re: Java Script in ASP
You're welcome. Glad to help.