【发布时间】:2012-10-15 20:04:00
【问题描述】:
当用户将鼠标悬停在某个字段上时,我正在使用这个精美的小 JavaScript 来突出显示该字段。您能否告诉我是否有办法添加一个onclick 函数,该函数将充当链接并转到一个 URL?
<script>
$(function() {
$('tr').hover(function() {
$(this).css('background-color', '#eee');
$(this).contents('td').css({'border': '0px solid red', 'border-left': 'none', 'border-right': 'none'});
$(this).contents('td:first').css('border-left', '0px solid red');
$(this).contents('td:last').css('border-right', '0px solid red');
},
function() {
$(this).css('background-color', '#FFFFFF');
$(this).contents('td').css('border', 'none');
$('a#read_message.php').click(function(){ URL(); });
});
});
</script>
【问题讨论】:
-
我如何获取 url 值,它是一个表格单元格中的链接还是它们都指向同一个 url
-
你有一个相当奇怪的 id '#read_message.php'?
标签: javascript jquery hyperlink