zoukankan      html  css  js  c++  java
  • 获取CheckBox的值

    前台获取

       function chkCheckBox() {
                var code_arr = new Array(); //定义一数组
                $('.C_B').each(function () {
                    if ($(this).prop("checked")) {
                        if ($(this).val() != "")
                        code_arr.push($(this).val());
                    }
                });
                if (code_arr.length == "") {
                    alert("请先选择之后再点击下一步!");
                    return false;
                }
                return true;
            }

    后台获取 asp.net webform情况下的

    <td>
          <input type="checkbox" value='<%# Eval("ID") %>' id="Check_Box" class="C_B" runat="server" /> 
     </td>
            /// <summary>
            /// 下一步按钮
            /// </summary>
            protected void btnnext_Click(object sender, EventArgs e)
            {
                List<string> IdArr = new List<string>();
              
                //遍历repeater控件的itemtemplate模版  
                foreach (RepeaterItem item in rptData.Items)
                {
                    HtmlInputCheckBox cb = (HtmlInputCheckBox)item.FindControl("Check_Box"); //根据控件id获得控件对象,cdDelete是checkBox控件的id  
                    if (cb.Checked == true)
                    {
                        IdArr.Add(cb.Value);
                    }
                } 
            }
  • 相关阅读:
    java项目中文件含义
    关于反射技术
    Subversion Edge部署
    svn Edge访问规则配置
    redhat开启端口
    关于Ant脚本
    Maven
    版本控制工具
    Oracle了解(一)
    java 空格替换%20
  • 原文地址:https://www.cnblogs.com/youmingkuang/p/6774274.html
Copyright © 2011-2022 走看看