0
嘿傢伙它的一個斑馬條表爲jquery im想知道如何使超鏈接onclick通過某些行的顏色到底部或頂部? 「單擊DN鏈接必須使突出顯示的行級別.highlight移動到上一行。將UP和DN按鈕的效果循環到表格中,以便在到達表格的頂部或底部時不會停頓「當超鏈接被點擊時,JQuery Pass COLOR默認行到下一行
我的代碼
$(function(){
\t $(".odd").hover(function() \t {
\t $(this).toggleClass("hovered");
\t }, function() {
\t $(this).toggleClass("hovered");
\t });
});
$(function(){
\t $(".even").hover(function() \t {
\t $(this).toggleClass("hovered");
\t }, function() {
\t $(this).toggleClass("hovered");
\t });
});
odd.hovered {
background-color:red;
}
.even.hovered{
background-color:red;
}
.highlight{
background-color:yellow;
}
.odd{
background-color:grey;
}
.even{
background-color:#D3D3D3;
}
<!-- saved from url=(0061)https://csunix.mohawkcollege.ca/tooltime/10065/f15/zebra.html -->
<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"></head><body>
<h2>2: Zebra Striping Demo</h2>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js">
</script>
<table width="200" border="1">
<caption><a href="https://csunix.mohawkcollege.ca/tooltime/10065/f15/zebra.html#">UP</a> Zebra Striping Demo <a href="https://csunix.mohawkcollege.ca/tooltime/10065/f15/zebra.html#">DN</a></caption>
<tbody><tr class="odd">
<td>January</td>
<td>February</td>
<td>March</td>
</tr>
<tr class="even">
<td>April</td>
<td>May</td>
<td>June</td>
</tr>
<tr class="highlight" >
<td>July</td>
<td>August</td>
<td>September</td>
</tr>
<tr class="even">
<td>October</td>
<td>November</td>
<td>December</td>
</tr>
<tr class="odd">
<td>Monday</td>
<td>Tuesday</td>
<td> Wednesday</td>
</tr>
<tr class="even">
<td>Thursday</td>
<td>Friday</td>
<td>Saturday</td>
</tr>
<tr class="odd">
<td>Spring</td>
<td>Summer</td>
<td>Fall</td></tr>
</tbody></table>
</body></html>
您是否嘗試過使其工作? – andi