lead2gold Posted June 8, 2006 Share Posted June 8, 2006 With respect to this example:[code]<table class="tablestyle"><tr class="rowA"><td class="cellA">Link</td></tr><tr class="rowB"><td class="cellB">Link</td></tr></table>[/code]Is it possible to make... say rowB a link to "/somepage.php" reguardless of where they clicked on the row?Is it also possible to make ... say cellA a link to "/anotherpage.php" reguardless of where they clicked in the cell?Is this something you need JavaScript for?If you visit my website [a href=\"http://hitech.lead2gold.org\" target=\"_blank\"]here[/a] you can see that the calendar works the same as everyone elses PHP calendar... but i wanted to make it so the entire cell became a link instead of just the anchor within.Chris Quote Link to comment https://forums.phpfreaks.com/topic/11505-making-a-table-cell-or-row-an-anchor/ Share on other sites More sharing options...
king arthur Posted June 8, 2006 Share Posted June 8, 2006 Your table cells need to look something like:[code]<td class="cellA"><a href="/anotherpage.php" style="width:XXX;display:block;">Link</a></td><td class="cellB"><a href="/somepage.php" style="width:XXX;display:block;">Link</a></td>[/code]where XXX is the width of the cell you want in pixels, you need to make all the anchors the same width in that table, they should all then fill the cells so moving the mouse anywhere in the cell highlights the link.Actually I'm not sure if you need the display:block there, try it with and without. Quote Link to comment https://forums.phpfreaks.com/topic/11505-making-a-table-cell-or-row-an-anchor/#findComment-43293 Share on other sites More sharing options...
nogray Posted June 8, 2006 Share Posted June 8, 2006 you can use an onclick event, like this[code]<table class="tablestyle"><tr class="rowA" onclick="location.href='some_page.php';" style="cursor:pointer;"><td class="cellA">Link</td></tr><tr class="rowB" onclick="location.href='some_page.php';" style="cursor:pointer;"><td class="cellB">Link</td></tr></table>[/code]The style style="cursor:pointer;" will make the mouse change to a finger so it looks clickable. Quote Link to comment https://forums.phpfreaks.com/topic/11505-making-a-table-cell-or-row-an-anchor/#findComment-43386 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.