Home > Article > Web Front-end > css application: click on the table to change the color of the clicked row
The code is as follows:
<script> function bgChange(obj) { objobj.bgColor=obj.bgColor==""?"#B6DC73":""; } </script> <table width="80%" border="1" bgcolor="#ffffcc"> <tr onclick="bgChange(this)"> <td>aa25.cn</td> <td>aa25.cn</td> </tr> <tr onclick="bgChange(this)"> <td>aa25.cn</td> <td>aa25.cn</td> </tr> <tr onclick="bgChange(this)"> <td>aa25.cn</td> <td>aa25.cn</td> </tr> </table>