如何选中全部/取消选中所有复选框列表. [英] how to check all/uncheck all the checkbox list.

查看:74
本文介绍了如何选中全部/取消选中所有复选框列表.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好.

我在这里有一个小问题.

我正在使用一个复选框列表,并且列表中正在使用的数据来自我的数据库,如何检查/取消选中复选框列表中的所有列表?


先感谢您! :)



-CHAOSGRAY-

hello guys.

im have a little problem here.

im using a checkboxlist, and the data im using in the list is coming from my database, how can i check/uncheck all the list in the checkbox list?


thank you in advance! :)



-CHAOSGRAY-

推荐答案

下面的链接将为您提供详细的过程,并附带说明以实现您想要的目标:
http://www.dotnetcurry.com/ShowArticle.aspx?ID=77 [ ^ ]

基本上,这只是一个javascript:

Below link will give you detail process with explainations to achieve what you want:
http://www.dotnetcurry.com/ShowArticle.aspx?ID=77[^]

Basically it is just a javascript:

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

function CheckBoxListSelect(cbControl, state)
{
       var chkBoxList = document.getElementById(cbControl);
        var chkBoxCount= chkBoxList.getElementsByTagName("input");
        for(var i=0;i<chkBoxCount.length;i++)

        {

            chkBoxCount[i].checked = state;

        }



        return false;

}



</script>


这篇关于如何选中全部/取消选中所有复选框列表.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆