在用户控件中有一个Linkbutton他有一个后台事件,这个按钮是写在table中,我想单这个按钮改变他所在的单元格的背景色,我写的事件是    
function Hcolor(d)
    {
            document.getElementById("d1").bgColor="red";
    }
可以改变,但一下子又被刷没了,不知道怎么改,求高手解决,在线等.....

解决方案 »

  1.   

    document.getElementById("d1").bgColor="red"; to
    document.getElementById("d1").style.background-color="red";
      

  2.   

     <td id="d1" onclick="Hcolor('d1')">
                                    <asp:LinkButton ID="lbtnAll" runat="server" Text="全部" Font-Underline="false" OnClick="lbtnNoRead_Click"></asp:LinkButton>
                                
                                </td>

     <td id="d1"">
                                    <asp:LinkButton ID="lbtnAll" runat="server" Text="全部" Font-Underline="false" OnClick="lbtnNoRead_Click" OnClientClick="Hcolor('d1')"></asp:LinkButton>
                                
                                </td>
    还有在后台
     case "全部":
                        condine = " and iAId in (select iAId from AnnounceIsRead where cUsercode='" + Session["username"].ToString() + "')";
                        lbtnAll.Attributes("OnClick","Hcolor('d1')")
                        break;
    condine是我查的条件