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
时间: 2024-10-16 22:05:19