链接整个表行? [英] Link entire table row?
本文介绍了链接整个表行?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我知道可以将整个表格单元格与CSS相关联。
I know it is possible to link an entire table cell with CSS.
.tableClass td a{
display: block;
}
有没有办法将链接应用到整个表行?
Is there a way to apply a link to an entire table row?
推荐答案
我同意 Matti 。很容易做一些简单的javascript。一个快速的jquery例子是这样的:
I agree with Matti. Would be easy to do with some simple javascript. A quick jquery example would be something like this:
<tr>
<td><a href="http://www.example.com/">example</a></td>
<td>another cell</td>
<td>one more</td>
</tr>
和
and
$('tr').click( function() {
window.location = $(this).find('a').attr('href');
}).hover( function() {
$(this).toggleClass('hover');
});
然后在您的CSS中
tr.hover {
cursor: pointer;
/* whatever other hover styles you want */
}
这篇关于链接整个表行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文