Table row like a link
by amateratsu
HTML
<body>
<table>
<tr url="google.com">
<td>foo</td>
<td>foo</td>
<td>foo</td>
<tr>
<tr url="bar.com">
<td>bar</td>
<tr>
</table>
</body>
CSS
td {
cursor: pointer;
*cursor: hand;
border: 1px solid #000;
}
JavaScript
$('body').on('mousedown', 'tr[url]', function(e){
var click = e.which;
var url = $(this).attr('url');
if(url){
if(click == 2 || (click == 1 && (e.ctrlKey || e.metaKey))){
window.open(url, '_blank');
window.focus();
}
else if(click == 1){
window.location.href = url;
}
return true;
}
});