アットウィキロゴ

SandBox > jQuery

「SandBox/jQuery」の編集履歴(バックアップ)一覧に戻る

SandBox/jQuery - (2010/02/14 (日) 04:07:30) のソース

#javascript(){{
  <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
  <script type="text/javascript">
$(function(){
  $("th:nth-child(odd)").addClass("odd");
  $("tr:nth-child(even)").addClass("even");

  $("tr:not(:first-child)").mouseover(function(){
    $(this).addClass("hover");
  }).mouseout(function(){
    $(this).removeClass("hover");
  })

  $("td").mouseover(function(){
    $("td:nth-child("+($("td").index(this)%$("th").size()+1)+")").addClass("hover");
  }).mouseout(function(){
    $("td:nth-child("+($("td").index(this)%$("th").size()+1)+")").removeClass("hover");
  })
})
</script>
}}
#html2(){{{{{{		
<table>
  <tr>
    <th>test</th>
    <th>test</th>
    <th>test</th>
  </tr>
  <tr>
    <td>test</td>
    <td>test</td>
    <td>test</td>
  </tr>
  <tr>
    <td>test</td>
    <td>test</td>
    <td>test</td>
  </tr>
</table>
}}}}}}