<input type=checkbox onclick='td1.bgColor="red";td2.bgColor="#ccccff"'>
<table name=tbl>
<tr>
   <td id=td1>11111</td>
   <td id=td2>22222</td>
</tr>
</table>

解决方案 »

  1.   

    <input type=checkbox onclick='if(this.checked){td1.bgColor="red";td2.bgColor="#ccccff";}else{td1.bgColor="white";td2.bgColor="#FFFFFF";}'>
    <table name=tbl>
    <tr>
       <td id=td1>11111</td>
       <td id=td2>22222</td>
    </tr>
    </table>
      

  2.   

    <form name = cc>
    <input type=checkbox name=aa onclick="if(aa.checked==true){bb.style.background='#ff0000';}else{bb.style.background='#000000';}">
    <table>
    <tr>
    <td id=bb bgcolor='#000000'>HELLO!</td>
    </tr>
    </table>
    </form>