脚踏祥云

导航

多选框全选-取消全选代码

<script language="javascript" type="text/javascript" > 

 

function fs_selectAll(value) {
            var ckelems = document.getElementById("<%=cblAllStudent.ClientID %>").getElementsByTagName("input");
            for (var i = 0; i < ckelems.length; i++) {
                if (ckelems[i].type == "checkbox") {
                    if (value == 1)
                        ckelems[i].checked = true;
                    else
                        ckelems[i].checked = false;
                }
            }
        }

 </script>

<div class="fsg_nr" style="width: 310px;" id="fsg_nr">
                            <div class="sgt_on" style="width: 300px;">
                                请选择共享对象</div>
                                <div class="r" style="padding-right: 20px;">
                                                <span id="selall"><a class="sl" href="javascript:fs_selectAll(1);">全选</a>&nbsp;<a
                                                    class="sl" href="javascript:fs_selectAll(0);">取消全选</a> </span>
                                            </div>
                            <div id="allfriend" style="width: 300px; height: 100px; overflow: scroll; overflow-x: hidden;">
                                <asp:CheckBoxList runat="server" ID="cblAllStudent" RepeatDirection="Horizontal"
                                    RepeatColumns="4" CellSpacing="6" CellPadding="0" OnDataBound="cblAllStudent_DataBound">
                                </asp:CheckBoxList>
                            </div>
                            <div class="tac">
                                <div class="gbs1">
                                    <asp:Button ID="Button1" runat="server" Text="确定" OnClick="Share_Click" CssClass="gb1-12" /></div>
                                <div class="c" />
                            </div>
                        </div>

posted on 2012-04-06 13:26  脚踏祥云  阅读(324)  评论(0编辑  收藏  举报