...

View Full Version : Dynamic link from cell



parallon
05-31-2006, 09: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:



<tr>
<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>
</tr>

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


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

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

Any help would be greatly appreciated.

Thanks in advance,

Parallon

fci
05-31-2006, 09: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;
}
--></script>
<table>
<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>
</table>

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

Parallon

parallon
06-01-2006, 05: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.

Thanks,

Parallon



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum