Jump to content

Table Links


newbman

Recommended Posts

I've made a table with anchors in them, but i have to click the text. Instead, i want to be able to click on any part of the td. Ne1 know how?-Newbman :)

Remove the anchor tags and put an onclick on the td's:
<head><style>table{  cursor:pointer;}</style></head><body><table border="1" width="50%"><tr><td onclick='window.location="http://www.google.com"'>Visit Google</td><td onclick='window.location="http://www.yahoo.com"'>Visit Yahoo</td></tr><tr><td onclick='window.location="http://www.microsoft.com"'>Visit Microsoft</td><td onclick='window.location="http://www.w3schools.com"'>Visit W3Schools</td></tr></table></body>

:)

Link to comment
Share on other sites

A better solution, if you want to accommodate people who have javascript disabled, use CSS on your links to make them the same width/height as your table cells:<style type="text/css"><!--td a {width: ##px;height: ##px;display: block;}--></style>And then just write your links in the <td>'s as you would normally....

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...