如何使整个表格行可点击?

4

我已经在这个网站上搜寻了更好的解决方案,但是似乎找不到正确的答案。

我希望在PC端可以让整个表格行可点击,在平板电脑中用户触碰行内任何地方也应有相同效果。目前我有以下代码,我更喜欢使用HTML或JavaScript等类似的解决方案。

<tr onclick="window.document.location='';">
  <td><img src="/chemsolver/images/help.jpeg" alt="" width="36" height="36"    id="Synthesis2" style="background-color: #996633" align="right" /></td>
  <td><a href="/chemsolver/help.php"> Help With Table </a></td>
</tr>
1个回答

3

在锚点标签上设置display:block,然后在锚点标签上设置高度。

http://jsfiddle.net/u2qLC/

或者在行上使用onclick事件,并在行上设置cursor:pointer,而不是使用锚点标签。


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接