html在线模拟网:http://www.w3school.com.cn/tiy/t.asp?f=html_basic

高亮显示表格当前行

<html>
 <head> 
  <title>高亮显示表格当前行</title> 
  <script language="JavaScript">
function trSelect(){
   if (event.srcElement.tagName=='TD'){
      for(i=0;i<nsDataGridTable.rows.length;i++){
         nsDataGridTable.rows[i].bgColor='';
      }
      event.srcElement.parentElement.bgColor='red';
   }
}

</script> 
 </head> 
 <body> 
  <div onmousedown="trSelect()"> 
   <table id="nsDataGridTable" onmouseover="trSelect()"> 
    <tbody>
     <tr>
      <td>111111</td>
      <td>111111</td>
     </tr> 
     <tr>
      <td>222222</td>
      <td>222222</td>
     </tr> 
     <tr>
      <td>333333</td>
      <td>333333</td>
     </tr> 
    </tbody>
   </table> 
  </div>  
 </body>
</html>

 

 

引用自: http://www.blogjava.net/gaich/archive/2005/07/05/7141.html

 

相关文章:

  • 2021-11-13
  • 2022-01-24
  • 2022-12-23
  • 2020-07-15
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-06-23
  • 2022-02-04
  • 2022-12-23
  • 2022-02-08
  • 2022-12-23
相关资源
相似解决方案