zoukankan      html  css  js  c++  java
  • 验证CheckBoxList至少要有一项选中

    <script language="javascript" type="text/javascript"> 
            
    <!--
            
    function  ClientValidate(sender, args)
            
    {
                
    var flag = false;
                
    var  inarr=form1.all.tags("input");
                
    for (var i=0; i<inarr.length; i++)
                
    {
                    
    if(inarr[i].type=="checkbox")
                     
    {
                        
    if(inarr[i].checked==true)    
                         
    {
                             flag 
    = true;
                         }

                      }

                 }

                 
    if (flag)
                 
    {
                    args.IsValid 
    = true;
                 }

                 
    else
                 
    {
                    args.IsValid 
    = false;
                 }

            }

            
    -->
    </script>
    <tr>
        
    <td align="right" bgcolor="#FFFFFF">用户权限:&nbsp;</td>
        
    <td bgcolor="#FFFFFF"><asp:CheckBoxList ID="cblrighgs" runat="server" RepeatLayout="Flow" RepeatColumns="5">
            
    </asp:CheckBoxList>
            
    <asp:CustomValidator ID="CustomValidator1" runat="server" ClientValidationFunction="ClientValidate"
                Display
    ="Dynamic" ErrorMessage="请选择用户权限"></asp:CustomValidator></td>
      
    </tr>
  • 相关阅读:
    BOM与DOM
    CSS中的长度单位及颜色表示
    关于display:grid layout
    关于position
    简单的注册表单
    We重邮
    APP定制开发的完整流程
    国内移动广告平台的混战大盘点
    Mobile App Monetization, Analysis & Mediation – Google AdMob
    代码优化
  • 原文地址:https://www.cnblogs.com/cnaspnet/p/729473.html
Copyright © 2011-2022 走看看