点击改变delelist的颜色

 function ChuanZhi(zhi) {
            var bian = document.getElementById("bian").value;
            if (bian.toString() == "") {
                bian = zhi;
            }
            document.getElementById(bian).style.backgroundColor = "#66CCFF";
            document.getElementById(bian).style.color = "#000000";
            document.getElementById("FuZhi").value = zhi;
            document.getElementById("bian").value = zhi;
            document.getElementById(zhi).style.backgroundColor = "#0066CC";
            document.getElementById(zhi).style.color = "#FFFFFF"; 
        }
<asp:DataList ID="DataList1" runat="server" RepeatDirection="Horizontal"
                RepeatColumns="7" Height="31px">
                <ItemTemplate>
                    <div id="<%#Eval("id") %>" onclick="ChuanZhi(<%#Eval("id") %>)" style="width: 80px;
                        height: 30px; line-height:30px; text-align: center; background-color: #66CCFF">
                        <%#Eval("ZhongWenMing")%>
                    </div>
                </ItemTemplate>
            </asp:DataList>

 

<input type="hidden" id="bian" />
        <input type="hidden" id="zhoushu" />

 

posted @ 2012-09-05 16:46  丶有点坏  阅读(147)  评论(0编辑  收藏  举报