Web >> Development >> HTML >>  How change the background color of table cells using CSS and Javascript

<head> .bgoff {border: 1px solid #000000; padding: 1;background-color: #FFFFFF} .bgon {border: 1px solid #000000; padding: 1;background-color: #a0a0FF} <script type="text/javascript">var switchTo5x=true;</script> <script type="text/javascript" src="https://ws.sharethis.com/button/buttons.js"></script> <script type="text/javascript">stLight.options({publisher: "83cf11a5-04b0-47d5-b5d0-fecf32207997", doNotHash: false, doNotCopy: false, hashAddressBar: false});</script> </head> <body> <table border="0" width="200"> <tr> <td width="33%" class="bgoff" align="center" OnMouseOver="this.className='bgon'" OnMouseOut="this.className='bgoff'">one</td> <td width="33%" class="bgoff" align="center" OnMouseOver="this.className='bgon'" OnMouseOut="this.className='bgoff'">two</td> </tr> </table> </body> </html>