Click in a <TD> tag

  • Thread starter Thread starter Magnus Blomberg
  • Start date Start date
M

Magnus Blomberg

Hello!

I have a table with several rows with text. I want to make the complete cell
(or row) clickable as a link/href.
Writing <a href...><td>bla bla</td></a> is not possible.

If this is possible I have to add several spaces to the text (bla
) to make the clickable area larger.
If I have to do this, how to disable the feature that formats the text as a
link (becames blue and underlined).

How to solve this? Please don't make me create pictures for all cells.
Regards Magnus
 
Hi magnus,
1)You can try to place a div inside the td with width and height 100% and
use the onclick of the div tag.
<table><tr><td width="100" height="100">
<div onclick="javascript:alert('h')" style = "width:100;height:100">bla
bla</div>
</td></tr></table>
or
2)You can use a style sheet to cancel the formatting for the hyperlinks and
make them appear as plain text.
 
You have to use JavaScript for this type of action, as you cannot surround a
table cell with a anchor tag (a href="").

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

***************************
Think Outside the Box!
***************************
 
<td onclick="alert('Thanks for the click.');" style="cursor: pointer;">some
text</td>

Ray at work
 
Back
Top