用户选择表格数据时,点击某行,高亮显示某行
<html> <head> <title></title> <style type="text/css"> .trbg { background-color:Red; } </style> <script src="Scripts/jquery-1.4.1.js" type="text/javascript"></script> <script type="text/javascript"> function change(obj) { $(obj).parent().parent().addClass("trbg").siblings().removeClass("trbg"); } </script> </head> <body> <table border="1" cellpadding="0" cellspacing="0"> <tr> <td>1</td> <td><a href="#" onclick="change(this)">奋斗奋斗</a></td> <td>1</td> </tr> <tr> <td>2</td> <td><a href="#" onclick="change(this)">脚本分享网</a></td> <td>2</td> </tr> <tr> <td>3</td> <td><a href="#" onclick="change(this)">脚本分享网</a></td> <td>3</td> </tr> <tr> <td>4</td> <td><a href="#" onclick="change(this)">脚本分享网</a></td> <td>4</td> </tr> </table> </body> </html>