<tr><td id="td1">Test</td></tr>
使用的javascript语句是这样的:document.getElementById("td1").style.backgroundColor="red";//你要的颜色
这样就可以,当然也可以修改其他的属性。

解决方案 »

  1.   

    <html><head>
    <script language="JavaScript">
    <!--function changColor()
    {
      document.getElementById("td1").style.backgroundColor="#FF9900";
    }
    //-->
    </script></head>
    <form name="form1">
    <table border="1" width="100%" name="table1">
      <tr>
        <td width="50%" id="td1" onclick="changColor()">click here!</td>
        <td width="50%"> </td>
      </tr>
    </table>
    </form></html>
    ok!!
    tank you......
      

  2.   

    不行的。
    我刚刚替你测试了。
    我有一个办法就是:
    <%
    String a = null;
    if((request.getParamter("a")==null);
    a = "#FFFFFF";
    else
    a =  request.getParamter("a");
    %>
    <table border="1" width="100%" bgColor="<%=a%>">
      <tr>
        <td width="50%" name="td1" onclick='<javascript:location.href="AdvSearchArticle.jsp&a = #FF9900"'>click here!</td>
        <td width="50%"> </td>
      </tr>
    </table>注意td是没有name属性的。