在.NET中,有如下控件:<asp:CheckBox ID="CbStart" runat="server" CssClass="ckb"/>
要求用JQ实现,当选中以上复选框时,调用JQ函数,并获取当前控件的ID值,将当前控件设为未选中状态。急用

解决方案 »

  1.   

    <asp:CheckBox ID="CbStart" runat="server" CssClass="ckb" onclick='change()'/>
    <script>
    function change(){
       alert($(this).attr('id'));
    $(this).attr('disabled','disabled');
    }
    </script>
    试试。。别忘了导入jquery库
      

  2.   


    这样获取不到控件的值,“undefined”
      

  3.   

    <asp:CheckBox ID="CbStart" runat="server" CssClass="ckb" onclick='change(this)'/>
    <script>
    function change(obj){
      alert($(obj).attr('id'));
    $(obj).attr('disabled','disabled');
    }
    </script>
      

  4.   

    <asp:CheckBox ID="CbStart" runat="server" CssClass="ckb" onclick='change(this)'/>
    <script>
    function change(obj){
      alert($(obj).attr('id'));
    $(obj).removeAttr('checked');
    }
    </script>
      

  5.   

    在JQ或JS里怎么调用后台带参的函数。
      

  6.   


    <script type="text/javascript">
            $(function(){
                $("[id$=CbStart]").click(function(){
                    if($(this).attr("checked") == true)
                    {
                        //$(this).attr("id"); 这是ID
                    }
                    else
                    {
                         //用$.ajax方法调用.cs文件方法,下面有方法示例
                    }
                });
            });
            
        </script>http://www.cnblogs.com/zhongweiv/archive/2011/10/29/JqueryCallBack.html
      

  7.   

    <asp:CheckBox ID="CbStart" runat="server" />
    $(function () {
               $("#<%=CbStart.ClientID %>").click(function () {
                   alert($(this).attr("id"));
                   $(this).attr("checked", !$(this).attr("checked"));
               });
    });
    在JQ或JS里怎么调用后台带参的函数。
    用Ajax调用HttpHandler或者asmx