View Full Version : Dynamic link from cell

05-31-2006, 10:06 PM
Hello all. I have a table which displays the results of a recordset. What I want to do is to have the results hyperlink to a details page of that particular record. For some reason it's not working for me. Here is the code that I have so far:

<td style="cursor:hand;" onclick="A HREF='DummyPage.asp?<%= Server.HTMLEncode(MM_keepNone) & MM_joinChar(MM_keepNone) & "ID=" & rsMods.Fields.Item("ID").Value %>'"><%=(rsMods.Fields.Item("FileName").Value)%></A></td>

And when I view the source, I get the following (which seems ok to me):

<td style="cursor:hand;" onclick="A HREF='DummyPage.asp?ID=2'">Result 1</A></td>

<td style="cursor:hand;" onclick="A HREF='DummyPage.asp?ID=1'">Result 2</A></td>

Any help would be greatly appreciated.

Thanks in advance,


05-31-2006, 10:40 PM
what you want:

<tr> <td style="cursor: pointer; cursor:hand;" onclick="location.href='test2.php'">Result 1</A></td> </tr>

slightly better:

<script type="text/javascript"><!--
function redirect(url) {
location.href = url;
<tr> <td style="cursor: pointer; cursor:hand;" onclick="redirect('test2.php')">Result 1</A></td> </tr>
<tr> <td style="cursor: pointer; cursor:hand;" onclick="redirect('test2.php')">Result 2</A></td> </tr>

05-31-2006, 11:22 PM
That worked perfectly. Thank you so much!!!


06-01-2006, 06:37 PM
Well, I thank you for the previous info, and now I was wondering if it is possible to either have it open a new window or a popup? Here is the code so far:

<td onMouseOver="style.backgroundColor='#FFFF99';" onMouseOut="style.backgroundColor='#FFFFFF'" STYLE="cursor:hand;" onClick="location.href='test2.php'">Result 1</A></td>

At one time I had it opening a popup, but I wasn't sure on how to pass URL information to it.