當鼠標懸點時,突出當前行

  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">  
  2.   
  3. <html xmlns="http://www.w3.org/1999/xhtml">  
  4. <head>  
  5.     <title></title>  
  6.     <style type="text/css">  
  7.    .hover  
  8.    {  
  9.        color:#fff;  
  10.        background-color:#f00;  
  11.    }  
  12.     </style>  
  13.      <script src="../Scripts/jquery-1.4.1.js" type="text/javascript"></script>  
  14.      <script type="text/javascript">  
  15.          $(document).ready(function () {  
  16.              $('tr').hover(function () {  
  17.                  $(this).find('td').addClass('hover');  
  18.              }, function () {  
  19.                  $(this).find('td').removeClass('hover');  
  20.              }  
  21.          )  
  22.          });  
  23.      </script>  
  24. </head>  
  25. <body>  
  26. <table border="1">  
  27. <thead>  
  28. <tr>  
  29. <th>ID</th><th>Name</th><th>Mark</th>  
  30. </tr>  
  31. <tr><td>100</td><td>Steven</td><td>100</td></tr>  
  32. <tr><td>101</td><td>Mike</td><td>70</td></tr>  
  33. <tr><td>102</td><td>Robot</td><td>80</td></tr>  
  34. </thead>  
  35. </table>  
  36. </body>  
  37. </html>  
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章