The first is too simple to say, the second is also very simple, but everyone has a different implementation method, the following gives a relatively concise approach to support IE6, IE7, FF2, other browsers are not tested (can be extended to the asp.net of the GridView):
<!--blog Gardener--> <!--mouse across table row discoloration-Compact implementation-support IE6, IE7, FF2, other browsers not tested--> <ptml> <pead> <title> Mouse Color across table rows-Compact implementation </title> <style type= "Text/css" > #tb {width:666px;border-collapse:collapse;border:1px solid #EEE; font-size:14px;} #tb th{background: #EEE; border-bottom:1px solid #CCC;p adding:4px; #tb td{border:1px solid #EEE;p adding:4px;} </style> </pead> <body> <table id= "TB" > <tr> <th> Product name </th> <th> Price ;/th> <th> inventory </th> <th> Shelves </th> </tr> <tr> <td> Ding Co favorite Fairy Four deluxe version-Ling yarn version </td& Gt <td>139</td> <td>10000000</td> <td>A12-253</td> </tr> <tr> <td& GT Four Deluxe version-Dream Glass edition </td> <td>139</td> <td>10000000</td> <td>A12-254</td> </ Tr> <tr> <td> Fairy Four General edition-starter </td> <td>69</td> <td>10000000</td> <td> A12-255</td> </tr> </table> <script type= "Text/javascript" > var Obj=document.getelementbyid ("TB"); for (Var i=0;i<obj.rows.length;i++) {//Loop table row Set mouse event: Ding Co obj.rows[i].onmouseover=function () {this.style.background= "#0EF";} Obj.rows[i].onmouseout=function () {this.style.background= "";} } </script>
[Ctrl + A All SELECT Note: If the need to introduce external JS need to refresh to perform]