2012-06-15 34 views

回答

3

如果你習慣使用,jQuery的嘗試:

$(function(){ 
$("tr").hover(function(){ 
    $(this).css('background-color', '#FFFF99');; 
    $(this).css('background-color', '#FFFFFF');; 
    }); 
}); 

更新時間:

添加類的 「TR」 標籤 例如:

<tr class="trOnHoverChange"></tr> 

$(function(){ 
$(".trOnHoverChange").hover(function(){ 
    $(this).css('background-color', '#FFFF99');; 
    $(this).css('background-color', '#FFFFFF');; 
    }); 
}); 
+2

這也工作得很好:onmouseover =「this.style.background ='紅色';」 onmouseout =「this.style.background ='#222222'」如果應用於ItemTemplate tr和AlternatingItemTemplate –

-1

我發現這類似於你的問題,並可能會指出你在正確的方向:

ASP.NET Gridview: Highlighting rows on mouse over then updating the highlighted rows

編輯

剛剛發現這一點,這聽起來像你現在在做什麼。

http://forums.asp.net/t/1450332.aspx

+0

不完全,李stview的工作方式與gridview完全不同。我知道對於GridView來說,它更容易,但我需要使用高級格式化,因此使用listview的原因。我相信我可能會擁有它,這可能只是一個設置背景顏色onmouseover,然後小組 –

+0

足夠公平,我做了一次類似的事情,但它很久以前,所以我不記得。 –

+0

這是你在做什麼? http://forums.asp.net/t/1450332.aspx –