function searchObjByTagName(obj, tag)
{
  while(obj!=null && typeof(obj.tagName) != "undefind")
  {
    if(obj.tagName == tag.toUpperCase()) return(obj);
    obj = obj.parentElement;
  }
  return null;
}
function mm(e)
{
  var td = searchObjByTagName(e, "TD");
  td.style.backgroundColor = "red";
  td.parentElement.style.backgroundColor = "white";
}<tr><td><input type=checkbox value=ok onclick="mm(this)">

解决方案 »

  1.   

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
    <title>无标题文档</title>
    <script language="javascript">
    function chaBG(tr,td){
      tr.bgColor="white";
      td.bgColor="red";
    }
    </script>
    </head><body>
    <table width="416" height="19" border="1" cellpadding="1" cellspacing="1" bgcolor="#0099FF">
      <tr id="tr1">
        <td>&nbsp;</td>
        <td id="td1"><form name="form1" method="post" action="">
          <input name="radiobutton" type="radio" value="radiobutton" onClick="chaBG(tr1,td1)">
        </form></td>
      </tr>
    </table>
    </body>
    </html>
      

  2.   

    上面的是单击,下面的是选中状态:<html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
    <title>无标题文档</title>
    <script language="javascript">
    function chaBG(tr,td){
      if(form1.rb.checked) {
        tr.bgColor="white";
        td.bgColor="red";
      }
    }
    </script>
    </head><body>
    <table width="416" height="19" border="1" cellpadding="1" cellspacing="1" bgcolor="#0099FF">
      <tr id="tr1">
        <td>&nbsp;</td>
        <td id="td1"><form name="form1" method="post" action="">
          <input name="rb" type="radio" value="radiobutton" onClick="chaBG(tr1,td1)">
        </form></td>
      </tr>
    </table>
    </body>
    </html>