日期:2014-05-17  浏览次数:20785 次

如何给table加链接
在页面上这样使用不起作用,鼠标点击事件只作用在table上,而点不到 <a> 上。
希望有经验的兄弟给指条明路。

PS:不能使用脚本,只能用HTML标签。

<a   href= "http://community.csdn.net ">
    <table>
        <tr>
            <td>
                Link   test!
            </td>
        </tr>
    </table>
</a>

------解决方案--------------------
<table onclick= "window.open( 'http://community.csdn.net ', '_self ') " style= "cursor:hand; ">
<tr>
<td>
Link test!
</td>
</tr>
</table>
------解决方案--------------------
没注意不能使用标签
<table>
<tr>
<td>
<a href= "http://community.csdn.net "> Link test! </a>
</td>
</tr>
</table>
那就只能把a加到td里了。
------解决方案--------------------
<a href= "http://www.sina.com ">
<table border= "10 ">
<tr>
<td> aaaaaaaaaaaaaaaaaaaa </td>
<td> bbbbbbbbbbbbbbbbbbbb </td>
</tr>
<tr>
<td> cccccccccccccccccccc </td>
<td> dddddddddddddddddddd </td>
</tr>
</table>
</a>
这显然是违反规则的,但是在html层面只能做到这些了!你要的要求只能做一个script实现了!
------解决方案--------------------
<table border=1 width=300 height=50>
<tr>
<a href= "http://community.csdn.net ">
<td style= 'cursor:pointer '>
Link test!
</td>
</a>
</tr>
</table>

------解决方案--------------------
放在table 和tr 中间就可以了
<table border=1 width=300 height=50> <a href= "http://community.csdn.net ">
<tr>

<td style= 'cursor:pointer '>
Link test!
</td>

</tr> <tr>

<td style= 'cursor:pointer '>
Link test!
</td>

</tr> <tr>

<td style= 'cursor:pointer '>
Link test!
</td>

</tr> <tr>

<td style= 'cursor:pointer '>
Link test!
</td>

</tr> <tr>

<td style= 'cursor:pointer '>
Link test!
</td>

</tr> <tr>

<td style= 'cursor:pointer '>
Link test!
</td>

</tr> </a>
</table>